Skip to content

Commit 04159a3

Browse files
authored
DOCSP-41726: acknowledgement error/result (#373)
* DOCSP-41726: acknowledgement error/result * add example, MM PR fixes 1 * PV tech review comment
1 parent cdfc956 commit 04159a3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

source/whats-new.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,24 @@ The 2.0 {+driver-short+} release includes the following improvements and fixes:
9292
contained the number of dropped indexes. See the
9393
:ref:`golang-remove-index` section of the Indexes guide to learn more.
9494

95+
- The driver no longer supports the ``mongo.ErrUnacknowledgedWrite`` sentinel
96+
error if a write operation is not acknowledged. To confirm that the server
97+
acknowledged a write operation, you must access the ``Acknowledged``
98+
property from the result struct returned by the write method.
99+
100+
The following example shows how to confirm acknowledgment of an insert
101+
operation:
102+
103+
.. code-block:: go
104+
:emphasize-lines: 6
105+
106+
res, err := coll.InsertOne(context.TODO(), bson.D{{"x", 2}})
107+
if err != nil {
108+
panic(err)
109+
}
110+
111+
fmt.Print(res.Acknowledged)
112+
95113
- You can set options for transactions run in a given session by
96114
creating a ``TransactionOptions`` instance and passing the instance to
97115
the ``SetDefaultTransactionOptions()`` method of the

0 commit comments

Comments
 (0)