0Pricing
MongoDB Academy · Lesson

ACID Guarantees in a Distributed Document Store

Learners will relate the four ACID properties to MongoDB's storage engine and understand which are provided by default at the single-document level.

What ACID Means for Databases

ACID stands for Atomicity, Consistency, Isolation, and Durability—four properties that guarantee reliable processing of database operations. These properties were first defined for traditional relational databases but are equally important in document stores. Understanding how MongoDB provides (or trades off) each property helps you design data models and operations that meet your application's reliability requirements.

Atomicity: All or Nothing

Atomicity guarantees that a set of operations either all succeed or all fail—there is no partial state. In MongoDB, single-document operations are always atomic. When you call updateOne with multiple update operators, the entire change is applied as a single atomic unit. This is possible because all the data for one document is typically stored together on disk in BSON format.

// This entire updateOne is atomic — both fields change together or neither does
db.accounts.updateOne(
  { _id: accountId },
  {
    $inc: { balance: -100 },
    $push: { transactions: { type: 'debit', amount: 100, date: new Date() } }
  }
)

All lessons in this course

  1. ACID Guarantees in a Distributed Document Store
  2. Starting a Session and Multi-Document Transaction
  3. Error Handling and Retry Logic
  4. Transaction Performance Considerations
← Back to MongoDB Academy