Suggest an editImprove this articleRefine the answer for “What is a transaction in MongoDB?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A transaction in MongoDB is a group of operations that run as a single unit, with a guarantee that either all of the operations apply, or none of them do: the data stays in a consistent state even if something goes wrong. **Key point:** a transaction guarantees Atomicity, Consistency, Isolation, and Durability (ACID), and is needed wherever the atomicity of actions matters - e.g. banking operations or updates across several collections that must stay strictly in sync.Shown above the full answer for quick recall.Answer (EN)ImageA transaction in MongoDB is a **group of operations that run as a single unit**, guaranteeing that either **all the operations apply**, or **none of them do**. That means the data stays in a consistent state, even if something goes wrong. ### The core idea A transaction is needed when preserving the **atomicity** of actions matters. For example: updating two documents in different collections and being sure it never happens that one gets updated while the other doesn't. ### What a transaction guarantees - **Atomicity**, all or nothing - **Consistency** of the data - **Isolation** of the changes - **Durability**, the write won't be lost after commit ### Where it's used - banking operations - complex updates across different collections - operations that need to stay strictly in sync ### Summary A transaction in MongoDB is a way to run several operations on data **as a single indivisible operation**, ensuring data integrity and stability.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.