MongoDB Transactions and ACID Compliance Flashcards
6 cards from real MongoDB practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 MongoDB Transactions and ACID Compliance flashcards as text
In which MongoDB version were multi-document ACID transactions introduced for replica sets?
Answer: MongoDB 4.0
Multi-document ACID transactions for replica sets were introduced in MongoDB 4.0. MongoDB 4.2 extended transactions to sharded clusters. Prior to 4.0, atomicity was guaranteed only at the single-document level.
What does ACID stand for in the context of database transactions?
Answer: Atomic, Consistent, Isolated, Durable
ACID stands for Atomicity (all operations succeed or all are rolled back), Consistency (data moves from one valid state to another), Isolation (concurrent transactions don't interfere), and Durability (committed transactions persist even after system failure).
How do you start a multi-document transaction in MongoDB using the Node.js driver?
Answer: session.startTransaction()
To use multi-document transactions in MongoDB, you first start a client session with client.startSession(), then call session.startTransaction(). All operations within the transaction must pass the session object, and you call session.commitTransaction() or session.abortTransaction() to finalize.
What happens to a MongoDB transaction if commitTransaction() is not called before the session times out?
Answer: The transaction is rolled back and all changes are discarded
If a transaction is not committed before the session or transaction timeout (default 60 seconds), MongoDB automatically aborts and rolls back the transaction. All write operations within the transaction are discarded as if they never occurred.
Which read concern is required to read the latest majority-committed data within a MongoDB transaction?
Answer: snapshot
Transactions default to 'snapshot' read concern, which provides a consistent snapshot of the data as of the transaction's start time. 'snapshot' read concern ensures that all reads within a transaction see the same consistent view of the data.
What is the recommended write concern for MongoDB transactions to ensure durability?
Answer: { w: 'majority' }
{ w: 'majority' } is the recommended write concern for transactions. It ensures the committed transaction has been written to a majority of replica set members, providing durability. Using w: 1 risks rollback if the primary fails before the secondary replicates the commit.
How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- 10geneducation.zendesk.com — Test dates, score release, passing score, test delivery, retake policy · verified Oct 2026
- learn.mongodb.com — Eligibility, fees, exam format, time limit · verified Oct 2026