MongoDB & NoSQL (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
Multi-Document ACID Transactions in MongoDB.
senior LevelMost AskedState ManagementDatabases & SQL
In Simple Words: MongoDB 4.0+ supports multi-document ACID transactions across collections and replica sets (and across shards in 4.2+):
- Uses sessions (
client.startSession()). - Commits via two-phase commit protocol (
session.commitTransaction()). - Best reserved for complex financial ledger operations; document embedding should remain the primary design pattern for high-scale performance.