Skip to content

Commit 7fbb830

Browse files
committed
DOCSP-41784 add support for explicit resource management note where applicable resources are declared
1 parent 969e9b9 commit 7fbb830

File tree

6 files changed

+20
-1
lines changed

6 files changed

+20
-1
lines changed

source/connect/connection-options/csot.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ adjust cursor handling by configuring either the cursor lifetime or cursor
195195
iteration mode if needed. To configure the mode, set the ``timeoutMode`` option
196196
to ``cursorLifetime``, which is the default, or ``iteration``.
197197

198+
.. include:: /includes/explicit-resource-management.rst
199+
198200
Cursor Lifetime Mode
199201
~~~~~~~~~~~~~~~~~~~~
200202

source/connect/mongoclient.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ with behavior compatible with the specified API version.
108108
The following code shows how you can specify the connection string and the
109109
{+stable-api+} client option when connecting to a MongoDB deployment on Atlas and
110110
verify that the connection is successful:
111+
112+
.. include:: /includes/explicit-resource-management.rst
111113

112114
.. literalinclude:: /code-snippets/connection/stable-api-connect.js
113115
:language: javascript

source/crud/transactions.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ You must perform the following steps when using this API:
159159
The following code demonstrates how to perform a transaction by using
160160
the Core API:
161161

162+
.. include:: /includes/explicit-resource-management.rst
163+
162164
.. literalinclude:: /code-snippets/transactions/txn-api-examples.js
163165
:language: javascript
164166
:emphasize-lines: 2,4,10,16,20,24,26

source/crud/transactions/transaction-core.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ This example code performs a transaction through the following actions:
148148
:start-after: start placeOrder
149149
:end-before: end placeOrder
150150

151+
.. include:: /includes/explicit-resource-management.rst
152+
151153
.. _nodejs-transaction-example-payment-result:
152154

153155
Transaction Results
@@ -165,7 +167,7 @@ order ``_id`` appended to the orders field:
165167
"_id": 98765,
166168
"orders": [
167169
"61dc..."
168-
]
170+
]
169171
}
170172

171173
The ``inventory`` collection contains updated quantities for the
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
..note:: Explicit Resource Management
2+
3+
Since v6.9, the {+driver-long+} now natively supports explicit resource
4+
management for ``MongoClient``, ``ClientSession``, ``ChangeStreams``, and
5+
cursors. To learn how to use explicit resource management, see
6+
the `v6.9 Release Notes
7+
<https://github.com/mongodb/node-mongodb-native/releases/tag/v6.9.0>`__ on
8+
GitHub. It is important to note that this is an experimental feature and
9+
subject to change.

source/monitoring-and-logging/change-streams.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ the ``insertDB`` database and prints change events as they occur:
136136
:language: javascript
137137
:linenos:
138138

139+
.. include:: /includes/explicit-resource-management.rst
140+
139141
When you run this code and then make a change to the ``haikus``
140142
collection, such as performing an insert or delete operation, you can
141143
see the change event document printed in your terminal.

0 commit comments

Comments
 (0)