Skip to content
Merged
Changes from all commits
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
41 changes: 33 additions & 8 deletions source/crud/transactions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@ error, the driver cancels the transaction and discards all data changes
before they ever become visible.

In MongoDB, transactions run within logical **sessions**. A
:manual:`session </reference/server-sessions/>` is a grouping of related
read or write operations that you intend to run sequentially. Sessions
enable :manual:`causal consistency
</core/read-isolation-consistency-recency/#causal-consistency>` for a
group of operations or allow you to execute operations in an
:website:`ACID transaction </basics/acid-transactions>`. MongoDB
guarantees that the data involved in your transaction operations remains
consistent, even if the operations encounter unexpected errors.
session is a grouping of related read or write operations that you
intend to run sequentially. Sessions allow you to run operations
in an ACID-compliant transaction, which is a transaction that meets
an expectation of atomicity, consistency, isolation, and durability.

When using the {+driver-short+}, you can create a new session from a
``MongoClient`` instance as a ``ClientSession`` type. We recommend that you reuse
Expand All @@ -54,6 +50,35 @@ instantiating a new client each time.
You must include the ``session`` as a parameter for any operations that you
want to include in a transaction.

Causal Consistency
~~~~~~~~~~~~~~~~~~

.. sharedinclude:: dbx/causal-consistency.rst

.. replacement:: insert-one-method

``insertOne()``

.. replacement:: update-one-method

``updateOne()``

.. replacement:: find-one-method

``find()``

.. replacement:: delete-one-method

``deleteOne()``

.. replacement:: majority-rc

``MAJORITY``

.. replacement:: majority-wc

``MAJORITY``

Methods
-------

Expand Down
Loading