0

Many realtime apps have documents that act as counters. For example, you might count 'likes' on a post, or the number of visits of a video.

According to my calculations using cloud firestore this value can not grow more than 8 millions per day

With Cloud Firestore and Distributed counter I can have (at most) :

1 write/second * 100 == 100 writes per second.

1 day = 86.400 seconds

86.400 * 100 = 8.640.000

( 100 : Limit maximum depth of subcollections)

How can this limit be exceeded for an application with many users?

Thanks you

John
  • 313
  • 4
  • 17
  • You can also take a look at the last part of my answer from this **[post](https://stackoverflow.com/questions/48534676/how-to-count-the-number-of-documents-under-a-collection-in-firestore/48540276#48540276)**. – Alex Mamo Nov 12 '18 at 16:35

1 Answers1

1

A proposed solution is explained in the documentation. You can shard the counter among multiple documents.

Or, you could count with some other storage mechanism (such as Realtime Database) that doesn't have same write limitations as Firestore.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • Hi Doug, is there any downsides for only keeping "counts" in Realtime DB and the rest of our DB in firestore? – aytunch Mar 02 '20 at 09:54