Skip to content

[v6.16] DOCSP-41784 Support for Explicit Resource Management (#1165) #1170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .backportrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
// the branches available to backport to
"targetBranchChoices": [
"master",
"v6.17",
"v6.16",
"v6.15",
"v6.14",
"v6.13",
"v6.12",
Expand Down
2 changes: 2 additions & 0 deletions source/connect/mongoclient.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ verify that the connection is successful:
Call the ``MongoClient.connect()`` method explicitly if you want to verify that the
connection is successful.

.. include:: /includes/explicit-resource-management.rst

To learn more about the {+stable-api+} feature, see the :ref:`{+stable-api+} page
<nodejs-stable-api>`.

Expand Down
2 changes: 2 additions & 0 deletions source/crud/query/cursor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ and the {+mdb-server+}:
:start-after: start close cursor example
:end-before: end close cursor example

.. include:: /includes/explicit-resource-management.rst

Abort
~~~~~

Expand Down
2 changes: 2 additions & 0 deletions source/crud/transactions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ the Core API:
const session = client1.startSession();
client2.db('myDB').collection('myColl').insertOne({ name: 'Jane Eyre' }, { session });

.. include:: /includes/explicit-resource-management.rst

To see a fully runnable example that uses this API, see the
:ref:`node-usage-core-txn` usage example.

Expand Down
4 changes: 3 additions & 1 deletion source/crud/transactions/transaction-core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ This example code performs a transaction through the following actions:
:start-after: start placeOrder
:end-before: end placeOrder

.. include:: /includes/explicit-resource-management.rst

.. _nodejs-transaction-example-payment-result:

Transaction Results
Expand All @@ -165,7 +167,7 @@ order ``_id`` appended to the orders field:
"_id": 98765,
"orders": [
"61dc..."
]
]
}

The ``inventory`` collection contains updated quantities for the
Expand Down
7 changes: 7 additions & 0 deletions source/includes/explicit-resource-management.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. tip:: Explicit Resource Management

The {+driver-short+} natively supports explicit resource management for
``MongoClient``, ``ClientSession``, ``ChangeStreams``, and cursors. This
feature is experimental and subject to change. To learn how to use explicit
resource management, see the `v6.9 Release Notes.
<https://github.com/mongodb/node-mongodb-native/releases/tag/v6.9.0>`__
2 changes: 2 additions & 0 deletions source/monitoring-and-logging/change-streams.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ the ``insertDB`` database and prints change events as they occur:
:language: javascript
:linenos:

.. include:: /includes/explicit-resource-management.rst

When you run this code and then make a change to the ``haikus``
collection, such as performing an insert or delete operation, you can
see the change event document printed in your terminal.
Expand Down
Loading