I am new to Firestore so I have a Profiles and Users collections. In the Cloud Firestore Console when I click on Database > Firestore > Data tab > Profiles or > Users the console is reading ALL the documents in each collection. These reads are counted in the Usage tab. So my question is if I have lets say 500K documents in the Profiles collection and clicked on Data I will be charged for reading 500K docs just to view the first 25 docs only. Just clicking on Data tab the console reads all the docs of the first Collection.
I tried using the filter but to use it you will have to click on the Collection and read all the docs first then you can edit the filter.
Is this the way it works or is it my misunderstanding?
I faced the same confusion a while ago and upon digging down to the issue I learnt that all the data which gets loaded in the 'Data' tab of Firestore page does count towards the overall Firestore usage.
However, I was concerned with the same question as yours thus I contacted Firebase support. They reverted back confirming the first instinct of mine(Document reads in 'Data' tab does count) BUT initially it reads only the first 300 documents of ANY selected collection, so even if your collection has over 1 million docs, it will still load only the first 300 documents.
They suggested a way around it until the Firebase team finds a legit solution
So my question is if I have lets say 500K documents in the Profiles collection and clicked on Data I will be charged for reading 500K docs
Absolutely not! You are only charged with read operations for the documents that are apart of the query. I don't know the exact number at which the first query is limited but the data is loaded in smaller chunks, with other words a pagination system is implemented. So once you scroll down other elements are loaded and so on.
If you intend to create an app that uses Firestore as backend, please also note that, offline persistence:
For Android and iOS, offline persistence is enabled by default.
For the web, offline persistence is disabled by default. To enable persistence, call the
enablePersistence
method.
- For the web, offline persistence is an experimental feature that is supported only by the Chrome, Safari, and Firefox web browsers. Also, if a user opens multiple browser tabs that point to the same Cloud Firestore database, and offline persistence is enabled, Cloud Firestore will work correctly only in the first tab.
This means, that once you get a document(s) from the Firebase servers, you are not charched anymore since the results are coming from the local cache.
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