Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions draft/core/write-operations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,18 @@ and :doc:`/applications/indexes`.
Isolation
---------

All operations inside of a *single* MongoDB document are atomic. An
update operation may modify more than one sub-document within a single
MongoDB document (or record) in a single operation that will either
succeed or fail and cannot leave the document in an in-between state.
When a single write operation modifies multiple documents, the
operation as a whole is not atomic, but the modification of each
document is. The modification of a single Mongo document (or record)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a single write write operation modifies multiple documents, the operation as a whole is not atomic, and other operations may interleave. The modification of a single document, or record, is always atomic, even if the write operation modifies multiple sub-documents within the single record.

remains atomic even if the write operation modifies more than one
sub-document *within* that document.

No other operations are atomic; however, you can attempt to isolate a
sequence of write operations from other read and write operations to
prevent undesirable interactions. For more information see
:doc:`Isolated write operations </reference/operator/atomic>` and
:doc:`/tutorial/perform-two-phase-commits`.
write operation that affects multiple documents using the :doc:`$atomic
isolation operator </reference/operator/atomic>`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should avoid using $atomic in this section because it's emphatically not atomic.


To isolate a sequence of write operations from other read and write
operations, see :doc:`/tutorial/perform-two-phase-commits`.

Architecture
------------
Expand Down