File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -366,3 +366,8 @@ disabled.
366366To disable retryable writes, specify
367367:urioption:`retryWrites=false <retryWrites>` in the
368368:ref:`connection string <mongodb-uri>` for the MongoDB cluster.
369+
370+ Error Handling
371+ ~~~~~~~~~~~~~~
372+
373+ .. include:: /includes/6.1-retry-writes-error-handling.rst
Original file line number Diff line number Diff line change 1+ Starting in MongoDB 6.1, if both the first and second attempt of a
2+ retryable write fail without a single write being performed, MongoDB
3+ returns an error with the ``NoWritesPerformed `` label.
4+
5+ The ``NoWritesPerformed `` label differentiates the results of batch
6+ operations like :method: `~db.collection.insertMany() `. In an
7+ ``insertMany `` operation, one of the following outcomes can occur:
8+
9+ .. list-table ::
10+ :header-rows: 1
11+
12+ * - Outcome
13+ - MongoDB Output
14+
15+ * - No documents are inserted.
16+ - Error returned with ``NoWritesPerformed `` label.
17+
18+ * - Partial work done. (At least one document is inserted, but not
19+ all.)
20+ - Error returned without ``NoWritesPerformed `` label.
21+
22+ * - All documents are inserted.
23+ - Success returned.
24+
25+ Applications can use the ``NoWritesPerformed `` label to definitively
26+ determine that no documents were inserted. This error reporting lets the
27+ application maintain an accurate state of the database when handling
28+ retryable writes.
29+
30+ In previous versions of MongoDB, an error is returned when both the
31+ first and second attempts of a retryable write fail. However, there is
32+ no distinction made to indicate that no writes were performed.
Original file line number Diff line number Diff line change @@ -51,6 +51,17 @@ results in a slower query than one without the option specified.
5151For an example that uses the ``*UCP`` option, see
5252:ref:`regex-example-pcre2-ucp`.
5353
54+ .. _release-notes-6.1-replication:
55+
56+ Replication
57+ -----------
58+
59+ .. _release-notes-6.1-retry-writes-errors:
60+
61+ Retryable Writes Error Handling
62+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63+
64+ .. include:: /includes/6.1-retry-writes-error-handling.rst
5465
5566General Changes
5667---------------
@@ -404,4 +415,3 @@ of the related projects.
404415 :hidden:
405416
406417 /release-notes/6.1-compatibility
407-
You can’t perform that action at this time.
0 commit comments