Skip to content

Commit 98ab65a

Browse files
authored
DOCSP-41784 Support for Explicit Resource Management (#1165)
* DOCSP-41784 add support for explicit resource management note where applicable resources are declared * DOCSP-41784 fix note format * DOCSP-41784 change to tip and move pages around * DOCSP-41784 reword tip for clarity * DOCSP-41784 update backport file and move tips to below code examples
1 parent c2de22c commit 98ab65a

File tree

7 files changed

+21
-1
lines changed

7 files changed

+21
-1
lines changed

.backportrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// the branches available to backport to
66
"targetBranchChoices": [
77
"master",
8+
"v6.17",
9+
"v6.16",
10+
"v6.15",
811
"v6.14",
912
"v6.13",
1013
"v6.12",

source/connect/mongoclient.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ verify that the connection is successful:
119119
Call the ``MongoClient.connect()`` method explicitly if you want to verify that the
120120
connection is successful.
121121

122+
.. include:: /includes/explicit-resource-management.rst
123+
122124
To learn more about the {+stable-api+} feature, see the :ref:`{+stable-api+} page
123125
<nodejs-stable-api>`.
124126

source/crud/query/cursor.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ and the {+mdb-server+}:
170170
:start-after: start close cursor example
171171
:end-before: end close cursor example
172172

173+
.. include:: /includes/explicit-resource-management.rst
174+
173175
Abort
174176
~~~~~
175177

source/crud/transactions.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ the Core API:
181181
const session = client1.startSession();
182182
client2.db('myDB').collection('myColl').insertOne({ name: 'Jane Eyre' }, { session });
183183

184+
.. include:: /includes/explicit-resource-management.rst
185+
184186
To see a fully runnable example that uses this API, see the
185187
:ref:`node-usage-core-txn` usage example.
186188

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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. tip:: Explicit Resource Management
2+
3+
The {+driver-short+} natively supports explicit resource management for
4+
``MongoClient``, ``ClientSession``, ``ChangeStreams``, and cursors. This
5+
feature is experimental and subject to change. To learn how to use explicit
6+
resource management, see the `v6.9 Release Notes.
7+
<https://github.com/mongodb/node-mongodb-native/releases/tag/v6.9.0>`__

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

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

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

0 commit comments

Comments
 (0)