can anybody specify the costs for me in the following scenario:
When a query with a snapshotlistener listens to a collection and one document of the collection will be added or updated, will I be charged for the document that was updated or for all documents in the query?
Example: I have a snapshotlistener on a user collection with a where statement that shows me 20 entries. Now one document in that query will be changed, will I be charged for all 20 documents, because the snapshotlistener returns 20 documents or only for the one that changed?
Thank you!
Cloud Firestore includes a no-cost tier to help you get started at no cost. After you exceed the usage and storage quotas for the no-cost tier, you're charged for the database operations you perform, the data you store, and the network bandwidth you use.
We can reduce the cost by a lot by using Firebase cloud functions. I love Cloud Firestore triggers! This does your job so smoothly and makes your app/website a lot faster.
Firestore offers free quota that allows you to get started at no cost. The free quota amounts are listed below. If you need more quota, you must enable billing for your Cloud Platform project.
Cloud Firestore is a NoSQL database that stores data in documents, arranged into collections. Firestore is optimized for such collections of small documents. Each of these documents includes a set of key-value pairs.
Your snapshot listener will fire immediately with the 20 documents that match your query, and subsequently when the document changes.
You will be charged for 21 document reads in this case: the 20 reads for the initial snapshots and then the 1 read for the modified doc.
You'll be charged for one read for the changed document.
Frank's answer is correct in that the first time you activate your listener, you'll automatically fetch down all 20 documents, but each subsequent document change will only result in one read.
The snapshot listener will fetch all the collection's documents every time you start the activity or the load the fragment. But if something changed in the document while you using the app only one document will get fetched again. So maybe the best way to maintain you budget is using the mvvm pattern with depnding on cach in not important aspects
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With