Maintaining atomicity of Firestore writes too large for a batch operation (>500)

Viewed 104

Firestore allows a maximum of 500 operations in a batch.

If you want to upload a complex document with subcollections that each have hundreds of documents, how are you supposed to ensure an atomic upload?

This question has been asked multiple times on SO, but all of them are some variation of "make multiple batches and retry if one fails" which IS NOT atomic.

1 Answers

This is not possible. If it were, it would have already been described in the other questions that you're referring to. This is a documented limitation of Firestore, and you'll have to work with it as-is.

The hard limit documentation can be found here:

Maximum number of writes that can be passed to a Commit operation or performed in a transaction: 500

Related