-2

I have 1 collection on Firestore database and there are 2000 test documents (records) in this collection. Firestore gives free 50.000 daily reading quota. When I run my Javascript code to query documents, my reading quota decreases more than I expected. If I count all documents by using one query, is that mean "2000 reading" operation or only "1 reading" operation?

user215422
  • 43
  • 5

2 Answers2

1

Currently firestore doesn't have any native support for aggregate queries over documents like sum of some fields or even count of documents.

So yes, when you count total number of documents in the collection then you are actually first fetching atleast the references for those docs.

So, having 2000 documents in a collections and using a query to count number of docs in that collection you are actually doing 2000 reads.

You accomplish what you want, you can take a look at the following also https://stackoverflow.com/a/49407570

Avinash Dhinwa
  • 370
  • 2
  • 13
1

Firebase Spark free give you

  • 1 GiB total - size of data you can store

  • 10GiB/month - Network egress Egress in the world of networking implies traffic that exits an entity or a network boundary, while Ingress is traffic that enters the boundary of a network In short network bandwidth on database

  • 20K/day Writes

  • 50K/day Reads

  • 20K/day Del

If You reading 2000 documents depends on calling a single call read cause one read if you reading multipal at one consider 1 reads the answer is depends how you reads you calling Firebase Console also consume some reads writes thats why quota decreases more than you expected

Morpheus
  • 550
  • 1
  • 9
  • 23