rgb1380
rgb1380

Reputation: 73

Cost of reads when matches in a query have been updated in Firestore

Folks,

Hope someone knows the answer to this Firebase costing question.

Imagine I am listening to a query stream. The query returns 10 Firebase documents. One of the matching documents gets updated and therefore the listener callback is triggered again with the 10 matching results. 9 documents in the result set haven not changed. Have I just incurred another 10 reads from Firebase from a costing perspective?

Upvotes: 0

Views: 41

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317372

Only the documents that change get read from the server after the first callback to the listener. Everything else comes from a cache in memory (and do not cost a read), as long as the listener is still attached to the query. You can find out which documents changed by looking at the QuerySnapshot - there will be a property that tells you which documents were actually added/changed/removed from the result set.

Upvotes: 1

Related Questions