0
votes

I'm making a complex application in Firestore which is going to contain a huge amount of data. I was wondering what is the read sequence of the document in firestore.

For example: When my app starts: Collection having 1000 documents is fetched for the first time. While my app is inactive more than 50 Documents are added to the collection.

So my question is: Is the listener is going to again fetch (1000+50) documents or only new 50 documents when my app becomes active again assuming offline persistence enabled. I am also going to add addSnapShotListener to services in. And I only want to have newly added documents to be fetched.

1

1 Answers

0
votes

Every time you perform a query, it will fetch all required documents from the server. The local cache will not help reduce the number of reads. It doesn't matter what you previously queried.

If you want to query the cache directly using offline persistence, you can do that without incurring the cost of reads, but it will not get any new data from the server.

Read more about how the Firestore cache works.