Take a look at this code example from the Firestore documentation: https://firebase.google.com/docs/firestore/query-data/get-data Why check if document != null? If I read the source code correctly (beginner), the exists method checks for nullity internally. Answer A successfully completed task will never pass null for the DocumentSnapshot. If the requested document does not exist, you’ll get an empty snapshot. This means that:
Tag: google-cloud-firestore
How to count the number of documents under a collection in Firestore?
I am trying to get CollectionReference count that exists on the Cloud Firestore, I have tried to get it with: But unfortunately, I’m getting: Is there is another way to get the count of another way to fix the IllegalStateException? Answer Edit: October 20th, 2022 Starting from now, counting the documents in a collection or the documents that are returned