Reputation: 73
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
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