Tuesday, April 14, 2026
Volume 1.3
All posts
Lv.2 BeginnerMongoDB
20 min readLv.2 Beginner
SeriesMongoDB ACID Mastery · Part 1/3View series hub

MongoDB ACID — Part 1: "NoSQL with transactions?" — ACID and MongoDB's evolution

MongoDB ACID — Part 1: "NoSQL with transactions?" — ACID and MongoDB's evolution

The old line that NoSQL has no transactions is no longer accurate for MongoDB. What changed is not a binary switch but a gradual expansion: single-document atomicity was there for a long time, while multi-document and distributed transactional scope arrived in stages — and you need that timeline to read today's manual limits fairly. This Part 1 maps the four ACID letters to operational questions, walks the 4.0 and 4.2 story, and resists the oversimplified CAP slogan in favor of what partition actually means. It also spells out the real costs of adopting transactions — contention, latency, retries — and ends with a short decision flow: model inside one document first, then pay for multi-document work only when invariants demand it. Later parts go deeper on Atomicity, Isolation, and Durability; consider this the grounding episode.

Series outline

  • Part 1 — ACID concepts + MongoDB’s historical context (this post)
  • Part 2 — Atomicity & Consistency in depth: single document vs multi-document (forthcoming)
  • Part 3 — Isolation levels and snapshot isolation internals (forthcoming)
  • Part 4 — Durability, WiredTiger, Write Concern (forthcoming)
  • Part 5 — Production patterns, performance, anti-patterns (forthcoming)

Table of contents

  1. Introduction — "NoSQL with transactions?"
  2. What is ACID?
  3. MongoDB and ACID — myths and history
  4. Why ACID is hard in NoSQL — beyond CAP, and the cost of transactions
  5. When do you need multi-document transactions? — a short decision flow
  6. Closing — Part 1 summary

1. Introduction — "NoSQL with transactions?"

In 2018, when MongoDB shipped version 4.0, many practitioners were genuinely surprised.

"NoSQL databases support ACID transactions?"

Since then, MongoDB has outgrown the label of a simple "NoSQL database." Multi-document ACID transactions, high-availability deployments, and enterprise-grade security and compliance features are all part of the story — and public references where MongoDB sits alongside mission-critical stacks in finance, healthcare, and e-commerce have grown. Still, it is hard to justify claims like "always the #1 choice in the market" with a single metric: hiring, references, workloads, regulation, SLAs, and existing team skills all matter.

This series aims to go beyond textbook definitions of MongoDB’s ACID behavior and into internals and trade-offs. This first installment frames what ACID asks of a system and how far MongoDB has supported those guarantees over time.


2. What is ACID?

Everyone memorizes the four letters early on; fewer people connect them to running systems. Here we treat each letter as an operational question.

Atomicity

Everything in a transaction must commit together or roll back together.

For a transfer between accounts, debiting one account without crediting the other would destroy money. Atomicity prevents that half-done outcome.

Consistency

The database must remain in a valid state before and after the transaction: schema rules, domain invariants, and integrity constraints hold. (Depending on context, "consistency" also means application-defined invariants.)

Isolation

Concurrent transactions must not observe each other's intermediate states; they should appear to run alone. What anomalies remain (dirty reads, phantoms, etc.) depends on isolation level — MongoDB’s specifics are for Part 3.

Durability

Once a result is successfully committed, it must survive later failures. Data acknowledged as "saved" should still be there after a restart. Disks, replication, and Write Concern are Part 4.


3. MongoDB and ACID — myths and history

3.1 Early years (2009–2017): "NoSQL means no ACID?"

MongoDB’s early story emphasized flexible schema and horizontal scale. Multi-document transactions across collections were not available in the product, and that gap fueled criticism.

Saying "there was no ACID at all" is misleading. Even then, MongoDB guaranteed atomic updates at the single-document level: reads and writes to one BSON document, including nested arrays and sub-documents, applied or rolled back as a unit. The real debate was less "ACID vs not" than where the supported transaction boundary ended.

3.2 Turning point: MongoDB 4.0 (2018) — multi-document ACID on replica sets

In June 2018, MongoDB 4.0 introduced multi-document ACID transactions for replica sets: transactions spanning multiple documents and collections.

3.3 MongoDB 4.2 (2019) — sharded clusters

Where 4.0 focused on replica sets, 4.2 extended transactional support to sharded clusters, enabling distributed transactions while keeping horizontal scaling in play.

VersionEra (approx.)Transaction-related notes
~3.xpre-2018Multi-document work often done in the application or via patterns
4.02018Replica set — multi-document ACID
4.22019Sharded cluster — distributed transactions
Later2020+Performance, operations, and feature evolution (see release notes)

Exact constraints depend on deployment topology (standalone vs replica set vs sharded); always read the manual for your server version.

3.4 Today — how to read the narrative

MongoDB is routinely evaluated for enterprise workloads, but adoption is driven by regulation, downtime tolerance, team skills, and stack fit — not a single leaderboard. Sweeping lines like "every bank runs only MongoDB" do not match reality; weigh public references and your own constraints.


4. Why ACID is hard in NoSQL — beyond CAP, and the cost of transactions

4.1 CAP and distributed systems

CAP is often taught as "pick two of consistency, availability, and partition tolerance." More carefully, the interesting case is when the network partitions: which guarantees you prioritize under partition is the heart of the discussion — not a universal slogan for every normal operation.

Many distributed stores, MongoDB included in its early years, did not enforce strong synchronous consistency on every operation in exchange for latency, availability, and scale. Multi-node ACID transactions necessarily add synchronization and consensus cost.

4.2 Document modeling and "natural" atomicity

Good document design can reduce the need for multi-document transactions. If data that would be split across tables in a relational model fits in one document, a single-document atomic update often suffices.

// Example: one order as one document (illustrative)
{
  _id: ObjectId("..."),
  orderId: "ORD-2026-001",
  customerId: "CUST-123",
  status: "confirmed",
  items: [
    { productId: "PROD-A", qty: 2, price: 15000 },
    { productId: "PROD-B", qty: 1, price: 32000 }
  ],
  totalAmount: 62000,
  createdAt: ISODate("2026-04-09T00:00:00.000Z")
}

If the boundary can live inside one document, you may not need a transaction across collections. Widen the document before you widen the transaction remains a useful design heuristic.

4.3 The cost of multi-document transactions

"Supported" does not mean "free."

  • Contention: hot documents or index ranges mean waits and retries.
  • Latency: consensus, logging, and lock acquisition interact with network RTT.
  • Retries: clients should plan for labels like TransientTransactionError and implement retry policies.
  • Topology: shard keys, sessions, and timeouts shape real-world behavior.

So: use transactions when needed; prefer single-document design when you can. Tuning and patterns are for Part 5; here we only fix that cost exists.


5. When do you need multi-document transactions? — a short decision flow

This is not a rigid rulebook — it is a question order common in design reviews.

  1. Can you model the state in one document?
    Often yes for nested arrays and sub-documents — single-document operations are enough.

  2. Is there an invariant across collections or documents?
    E.g. stock decrement and order confirmation, or paired debit/credit — then multi-document transactions enter the conversation.

  3. Is the key hot?
    Even with transactions, you may need sharding and aggregation strategy; transactions are not a magic concurrency cure-all.

  4. Can the application handle retries or compensating actions?
    Distributed systems rarely assume "success on the first try" only.

Typical cases that need multi-document work

  • Transfers updating different documents that must move together.
  • Cross-collection invariants such as orders and inventory.

Often handled with single-document atomicity

  • $push / $pull for arrays
  • $set on multiple fields
  • $inc for counters

6. Closing — Part 1 summary

ThemeTakeaway
ACIDMap each letter to operational questions, not mnemonics alone.
MongoDB historySingle-document atomicity predates multi-document and distributed scope.
4.0 / 4.2Replica set support first, then sharded clusters.
DesignAsk whether state fits inside one document before paying multi-document costs.
NextPart 2 goes deeper on Atomicity and Consistency, rollback behavior, and error semantics.

References


Written April 2026. Product versions, licensing, and cloud pricing change — cite official docs and release notes.

Share This Article

Series Navigation

MongoDB ACID Mastery

1 / 3 · 1

Previous
View full series
Next

Recommended Reads

MongoDB and DocumentDB in 10 Minutes — A Practical Primer

MongoDB and AWS DocumentDB are names you hear often, yet it is still hard to grasp what they are and how they differ in one pass. This guide is for readers who know relational databases but find document-oriented NoSQL unfamiliar: from what a document is, through the roles of MongoDB and DocumentDB, API compatibility limits, selection criteria, collections, BSON, and embed-versus-reference modeling—in about ten minutes of reading. It aims for a grounded mental model without hype, and leaves you knowing what to open next in the official docs or a local sandbox.

Read

Why PostgreSQL? Part 5 — The ecosystem: pgvector, PostGIS, TimescaleDB

One more PostgreSQL extension—and you can seriously discuss vector search, geospatial queries, time-series analytics, and BM25-style full-text search on the same engine. This series finale walks through pgvector, PostGIS, TimescaleDB, and ParadeDB (pg_search): what public benchmarks and vendor write-ups claim, where “replace the specialist” is conditionally true, and how to read latency/cost numbers when managed services, self-hosting, and tuning assumptions differ. It closes the five-part arc on why PostgreSQL is often the lowest-regret default—reliability, extensibility, ecosystem depth—and when a separate system still earns its place. Use the decision inputs at the end alongside the comparison table: growth rate, staffing, failure tolerance, compliance, and how you define TCO.

Read

Why PostgreSQL? Part 4 — MongoDB & Oracle: real migration stories

If you are already on MongoDB or Oracle, moving to PostgreSQL is not a vague someday project—it hits budget, performance, and operations immediately. This post stays between the two lazy extremes (“trivial” vs “impossible”): what triggered real MongoDB→Postgres and Oracle→Postgres moves, how long they took, what hurt more than expected, and what changed afterward. Figures such as Infisical’s reported database cost reduction after leaving MongoDB, or wide TCO improvement narratives away from Oracle, come from public write‑ups, case studies, and vendor materials—so you should separate license vs labor vs migration project costs and read them as directional, not universal guarantees. The article also stresses that schema redesign and query work often travel with the database change, so “Postgres magic” and “refactoring wins” should not be collapsed into one headline. It closes with a compact decision frame so you can judge whether migration is a sensible next step for your team—not a moral obligation.

Read

Explore this topic·Start with featured series

한국어

Follow new posts via RSS

Until the newsletter opens, RSS is the fastest way to get updates.

Open RSS Guide