Firebase: What is atomicity & how to accurately increment/decrement values in cloud Firestore

Click for: original source

In computer science, ACID (Atomicity, Consistency, Isolation, Durability) is a set of properties of database transactions intended to guarantee validity even in the event of errors, connection issues, power failure, and etc. An article by Jeff Lewis about atomicity in Firebase.

An Atomic Transaction is unique such that all of the operations occur successfully or the entire atomic transaction fails.

Since an Atomic Transaction fails completely if all of the operations are successful, Atomicity mitigates the risk of updates to the database from partially completing, which could cause data issues down the line as your application scales.

The article further describes:

  • What is atomicity?
  • Why do we use atomicity?
  • When to use atomicity and issues it prevents
  • How do we use atomicity + Firebase cloud Firestore?

Plenty of code examples in JavaScript and React included. Good read!

[Read More]

Tags nosql infosec cloud app-development web-development