Suggest an editImprove this articleRefine the answer for “How does MongoDB implement atomicity without transactions?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)MongoDB provides atomicity at the level of a single document even without multi-step transactions: every write operation (`insert`, `update`, `delete`) on one document happens as an indivisible unit - either the whole document gets updated, or it doesn't change at all. **Key point:** this atomicity only holds within a single document; when several documents need to be updated at once, multi-document transactions are used instead.Shown above the full answer for quick recall.Answer (EN)ImageMongoDB provides atomicity **at the level of a single document**, even without multi-step transactions. This works because **every write operation (**`insert`**,** `update`**,** `delete`**) on one document happens as an indivisible unit** - either the whole document gets updated, or it doesn't change at all. ### The key mechanisms that make this work #### 1. A document is the smallest atomic unit MongoDB stores data as whole BSON documents. When a document is updated, the DBMS doesn't change "parts of a row", it commits the document's state as a whole. So the operation's outcome is always binary: - the update succeeds → the new document is written in full - it fails → the document stays as it was #### 2. Document-level locking A lock is placed on a document during a write, ruling out concurrent, conflicting changes. That guarantees two clients can't modify a document at the same time and overwrite each other's data. #### 3. A change log (a write-ahead log / journal) Before confirming an operation, MongoDB writes the change to a log. If a failure occurs, the database rolls back unfinished operations and returns the document to a consistent state. ### What this gives you Without transactions, MongoDB guarantees, for every document: | Property | Guarantee | |---|---| | Atomicity | the document changes completely, or not at all | | Predictability | no "half-done" updates | | Integrity | the data never ends up in an inconsistent state | ### Where the limits are This atomicity **only holds within a single document**. If **several documents need to be updated at once**, that's where **multi-document transactions** come in. ### Summary MongoDB provides atomicity without transactions because operations on a single document are indivisible: the document is updated in full, under a lock and with journaling, ruling out partial changes and data corruption.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.