Are firestore security rules and writes atomic?

BOOnZ

Let’s assume that multiple users are performing writes to a same document.

Say my firestore security rules will only allow write if resource.data.status == true.

My question is that every user will attempt to write the document with a whole bunch of other fields, and set the status to false thus preventing other writes.

Is the rule evaluation and write process atomic such that there are no race conditions where more than one user writes security rules will see resource.data.status == true?

Frank van Puffelen

Each set(), update(), delete(), or runTransaction() is executed as an atomic operation. It either succeeds completely or fails completely, and no client will ever see partial results from such an operation.

If you want multiple such operations to succeed or fail together, you can combine them in a batched write. All operations in a batch either succeed or all of them fail.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related