Transactions
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
know when multi-document transactions are needed and what they cost.
Planned topics
- Single-document updates are atomic; good modeling often removes the need for transactions.
- Multi-document transactions exist (need a replica set or sharded cluster; verify version support).
- Cost: more latency, more locking and memory, short time limits, retries on transient errors.
- Use them for real cross-document invariants (move a value between two documents), not as a habit.
Draft outline details
Demonstration
Spring @Transactional with a MongoTransactionManager bean, and a note that it fails on a standalone server.
Check your understanding
When is a transaction not needed?
Show answer
When the change fits in one document, since that write is atomic.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.