From the documentation I know we can have 1 write per second in a document. Is there any limitation to how many documents can be created per seconds to a subcollection?
The reason I am asking this is, I am using the transaction to create a new document in subcollection of messages in my chat app, But as we know transactions do not have offline support, so should I use just set function to add a new message, will it be a correct choice?
1 Answers
There is not enough information here to know exactly what limit applies to your use case.
The documentation says there are two possible limits you might encounter:
Maximum write rate to a collection in which documents contain sequential values in an indexed field: 500 per second
So, if you are writing to a collection that has an index on a field that's being incremented sequentially as you write new documents, you will be limited to 500 per second.
Another limit you might reach instead:
Maximum writes per second per database: 10,000 (up to 10 MiB per second)
If your new documents do not have a per-index limit on sequential fields, then you will be limited to 10,000 document writes be second total for all document writes in your Firestore instance.