Quick revision
The short answer
The history tells us that MongoDB transactions exist and work, but the engine, the data model and its performance are still optimised for single-document operations, so a design that depends on multi-document transactions on most hot paths is a signal that the domain may fit a relational model better. At the same time relational databases have added strong JSON support, so the gap has narrowed from both sides, and the choice should be driven by access patterns, consistency needs, team skills and operational maturity rather than feature checklists. As a leader I would turn that into guidance with concrete examples of good fits for each and a short design review for every new core data store.
What to remember
In this answer, we saw that MongoDB's transactions, added in 4.0 and extended to shards in 4.2, are real and reliable, but the engine and model remain optimised for single-document operations, so heavy reliance on multi-document transactions signals a relational domain. Relational databases have meanwhile adopted JSON, narrowing the gap. So the choice rests on access patterns, consistency needs, team skills and operational maturity, captured in guidance with concrete examples of good fits and a short design review for new core stores.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The history tells us that MongoDB transactions exist and work, but the engine, the data model and its performance are still optimised for single-document operations, so a design that depends on multi-document transactions on most hot paths is a signal that the domain may fit a relational model better. At the same time relational databases have added strong JSON support, so the gap has narrowed from both sides, and the choice should be driven by access patterns, consistency needs, team skills and operational maturity rather than feature checklists. As a leader I would turn that into guidance with concrete examples of good fits for each and a short design review for every new core data store.
Background to this question
For years the standard MongoDB advice was to model data so that transactions were not needed, because the database did not have them. Version 4.0 added multi-document ACID transactions on replica sets in 2018, and 4.2 extended them to sharded clusters. Since then, every database choice in a company has a new argument: 'MongoDB has transactions now, so it can do everything PostgreSQL does.' A senior leader is asked this question to see whether they can read a technology's history for what it says about its design, and turn that into decisions teams can apply. In this answer, we will look at what changed and what did not, what heavy transaction use signals, how relational databases moved toward documents, the criteria I would use, and how I would write the guidance.
1What Changed in 4.0 and What Did Not
What changed is real. MongoDB transactions provide snapshot isolation, all-or-nothing commits and majority durability across documents and collections, and across shards since 4.2. Correctness-critical operations that once needed awkward patterns, such as two-phase commits written by hand, can now be written plainly.
What did not change is the centre of gravity. The storage engine, the query planner, the sharding design and the documentation are all built around the document as the unit of work. A single-document write is the cheap, fast, conflict-free path. A transaction adds coordination, a snapshot held open, a limit of 60 seconds by default, aborts on write conflicts that must be retried, and extra cost across shards. In other words, transactions are a reliable tool for the cases that need them, not a reason to model data as normalised tables.
2What Heavy Transaction Use Signals
If a team's design needs multi-document transactions on most write paths, it usually means that the data that must change together lives in different documents. In a document database the first answer to that is to put it together. If that is impossible, because the same entities are shared by many aggregates, related many-to-many, and changed from many directions, the domain is relational by nature.
So I treat transaction density as a design metric. A system where one in a hundred operations uses a transaction, for a transfer or a rare cross-aggregate change, is a healthy document design. A system where every request opens a transaction across five collections is a relational model running on an engine optimised for something else, and it will pay for that in latency, conflicts and complexity.
| Signal | Points toward | Why |
|---|---|---|
| Most writes change one aggregate | MongoDB | single-document atomic writes are the fast path |
| Flexible, varying fields per record | MongoDB or JSONB | schema flexibility without migrations |
| Most writes span several entities | Relational | transactions on every path cost more in MongoDB |
| Many ad hoc joins and reports | Relational | planner and SQL built for joins |
| Very high write scale, simple access | MongoDB with sharding | horizontal scaling by shard key |
| Strong constraints across entities | Relational | foreign keys and checks in the database |
3The Gap Narrowed From Both Sides
While MongoDB added transactions, schema validation and better joins, relational databases moved toward documents. PostgreSQL's JSONB type stores binary JSON with GIN indexes for containment queries and expression indexes on specific paths, and MySQL has a JSON type with generated-column indexes. So a team that wants flexible attributes on a product, or a document-shaped settings blob, no longer needs a document database for it.
The practical effect is that neither 'we need flexibility' nor 'we need transactions' decides the question any more, because both families offer both. What decides it is the shape of the workload and the organisation that will run it.
4The Criteria I Would Use
First, access patterns: list the main reads and writes. If most are 'load or save one aggregate by id', a document model fits; if they are joins across shared entities and flexible reporting, a relational model fits. Second, consistency needs: which invariants span entities, and how often are they touched? Third, team skills: a team fluent in SQL and relational modelling will build a better PostgreSQL system than a mediocre MongoDB one, and the reverse is also true. Fourth, operational maturity: who runs it, how are backups, upgrades, monitoring and failover handled, and does the company already have that capability for one of the options?
Feature checklists are the wrong method because every serious database now ticks most boxes. Two systems that both 'support transactions' and 'support JSON' can differ by ten times in cost and complexity for a given workload.
5Turning It Into Guidance
I would write a short guide with concrete examples rather than abstract rules. Good MongoDB fits: a product catalogue with varied attributes, user profiles and preferences, content and event documents, IoT device state, where each record is read and written as a whole. Good relational fits: ledgers, billing, inventory across warehouses, order management with many cross-entity rules, and anything with heavy reporting. PostgreSQL with JSONB covers the middle, where a relational core has some flexible parts.
Then I would require a short design review for any new core data store, a one or two page note listing the access patterns, cross-entity invariants, expected transaction density, scale, and who operates it. Reviews are quick for clear cases and valuable for borderline ones. Existing systems are not migrated because of the guide; they are revisited when they show the signals, such as rising transaction use or join-heavy pipelines.
- List access patterns and invariantsfrom the design note
- Do most writes stay within one aggregate?transaction density is the key numberYesConsider MongoDBNoLean relational
- Heavy ad hoc joins or reporting?reporting can also go to a warehouseYesRelational, maybe with JSONBNoKeep the document option
- Can the team run it well?skills and operations countYesApprove with an ownerNoChoose what the team can operate
4 steps in order. Play them, or step through them one at a time.
6Follow-up questions
Does that mean MongoDB transactions should be avoided?
No. They should be used where an invariant truly spans documents, such as a transfer, and they work well there. The point is that needing them everywhere is a modelling signal, not that using them is wrong.
How would you handle a team that wants MongoDB because of schema flexibility alone?
I would show them JSONB in PostgreSQL and ask what else drives the choice. If their access patterns are aggregate-shaped and they have the skills, MongoDB may still be the better fit; if not, flexibility alone is not a reason.
What if a system already shows the relational signals on MongoDB?
First, redesign documents around access patterns, which often removes most transactions and lookups. If the domain is still relational, plan an incremental migration of that area, starting with the most transaction-heavy paths.
7Conclusion
In this answer, we saw that MongoDB's transactions, added in 4.0 and extended to shards in 4.2, are real and reliable, but the engine and model remain optimised for single-document operations, so heavy reliance on multi-document transactions signals a relational domain. Relational databases have meanwhile adopted JSON, narrowing the gap. So the choice rests on access patterns, consistency needs, team skills and operational maturity, captured in guidance with concrete examples of good fits and a short design review for new core stores.
Open with
I read the history as a statement about the design centre. MongoDB 4.0 added real multi-document ACID transactions, and 4.2 extended them to sharded clusters, and they work.
Then, if they want more
But the engine, planner, sharding and data model are still built around the single document as the unit of work. Single-document writes are the fast, conflict-free path; transactions add a held snapshot, a sixty second default limit, write conflicts that need retries, and extra cost across shards.
So if a team's design needs multi-document transactions on most write paths, I take that as a signal that the domain is relational and they are modelling tables in documents.
At the same time, PostgreSQL and MySQL now have solid JSON support, so flexibility alone is no longer a reason to pick MongoDB, and transactions alone are no longer a reason to avoid it.
I would base the choice on access patterns, which invariants span entities and how often, the team's skills, and who will operate it, not on feature checklists, since every serious database ticks most boxes.
As a leader I would write short guidance with concrete good fits, like catalogues and profiles for MongoDB and ledgers and billing for relational, and require a brief design review for every new core data store.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- MongoDB manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "MongoDB added multi-document ACID transactions in 4.0 after years of advice to avoid...": https://scrivio-interview-library.netlify.app/databases/mongodb/6343794e91/