@@ -7,15 +7,15 @@ Mongo()
77.. contents:: On this page
88 :local:
99 :backlinks: none
10- :depth: 1
10+ :depth: 2
1111 :class: singlecol
1212
1313Description
1414-----------
1515
1616.. versionchanged:: 4.2
1717
18- .. method:: Mongo(host, {+auto-encrypt-options+})
18+ .. method:: Mongo(host, {+auto-encrypt-options+}, api )
1919
2020 JavaScript constructor to instantiate a database connection from
2121 :binary:`~bin.mongosh` or from a JavaScript file.
@@ -36,21 +36,19 @@ Description
3636
3737 - string
3838
39- - Optional. The host, either in the form of ``<host>`` or
39+ - * Optional* . The host, either in the form of ``<host>`` or
4040 ``<host><:port>``.
4141
4242 If omitted, :method:`Mongo` instantiates a connection to the
4343 localhost interface on the default port ``27017``.
4444
4545 * - ``{+auto-encrypt-options+}``
4646
47- - Document
47+ - document
4848
49- - *Optional*
50-
51- .. versionadded:: 4.2
52-
53- Configuration parameters for enabling
49+ - .. versionadded:: 4.2
50+
51+ *Optional*. Configuration parameters for enabling
5452 :ref:`manual-csfle-feature`.
5553
5654 ``{+auto-encrypt-options+}`` overrides the
@@ -59,14 +57,22 @@ Description
5957 inherits the client-side field level encryption configuration
6058 of the current database connection.
6159
62- For documentation of usage and syntax, see
63- :ref:`{+auto-encrypt-options+}`.
60+ See :ref:`{+auto-encrypt-options+}` for usage and syntax
61+ details.
62+
63+ * - ``api``
64+
65+ - document
66+
67+ - *Optional*. Configuration options for enabling the
68+ :ref:`Stable API <stable-api>`.
69+
70+ See :ref:`mongo-api-options` for usage and syntax details.
6471
6572.. seealso::
6673
6774 :method:`Mongo.getDB()` and :method:`db.getMongo()`
6875
69-
7076.. _{+auto-encrypt-options+}:
7177
7278``{+title-auto-encrypt-options+}``
@@ -261,9 +267,32 @@ following parameters:
261267 indexed fields without the ``crypt_shared`` library. For details,
262268 see :ref:`qe-reference-mongo-client`.
263269
264- Example
270+
271+ .. _mongo-api-options:
272+
273+ ``api``
265274-------
266275
276+ The ``api`` parameter specifies configuration options for the
277+ :ref:`Stable API <stable-api>`. You can enable or disable optional
278+ behavior using the following options:
279+
280+ .. include:: /includes/stable-api-options.rst
281+
282+ .. |param| replace:: Option
283+ .. |apiVersion| replace:: ``version``
284+ .. |strict| replace:: ``strict``
285+ .. |deprecation| replace:: ``deprecationErrors``
286+
287+ The ``api`` parameter has the following syntax:
288+
289+ .. code-block:: javascript
290+
291+ { api: { version: <string>, strict: <boolean>, deprecationErrors: <boolean> } }
292+
293+ Examples
294+ --------
295+
267296Connect to a MongoDB Cluster
268297~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269298
@@ -284,8 +313,8 @@ Issue operations against the ``cluster`` object to interact with the
284313
285314.. _mongo-connection-client-side-encryption-enabled:
286315
287- Connect to a MongoDB Cluster with Client-Side Encryption Enabled
288- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
316+ Connect to a Cluster with Client-Side Encryption Enabled
317+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
289318
290319Configuring client-side field level encryption for a :ref:`locally
291320managed key <field-level-encryption-local-kms>` requires specifying a
@@ -345,8 +374,8 @@ a complete list of client-side field level encryption methods.
345374
346375.. _mongo-connection-automatic-client-side-encryption-enabled:
347376
348- Connect to a MongoDB Cluster with Automatic Client-Side Encryption Enabled
349- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
377+ Connect to a Cluster with Automatic Client-Side Encryption Enabled
378+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
350379
351380Configuring client-side field level encryption for a :ref:`locally
352381managed key <field-level-encryption-local-kms>` requires specifying a
@@ -431,3 +460,23 @@ the specified data encryption key can decrypt the field.
431460
432461See :doc:`/reference/method/js-client-side-field-level-encryption` for
433462a complete list of client-side field level encryption methods.
463+
464+ Connect to a Cluster with the Stable API Enabled
465+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
466+
467+ The following operation creates a new connection object from within a
468+ :binary:`~bin.mongosh` session. The :ref:`mongo-api-options` option
469+ enables Stable API V1 and specifies that you cannot
470+ run deprecated command or commands outside of the Stable API.
471+
472+ .. code-block:: javascript
473+
474+ cluster = Mongo(
475+ "mongodb://mymongo.example.net:27017/?replicaSet=myMongoCluster",
476+ null,
477+ { api: { version: "1", strict: true, deprecationErrors: true } }
478+ )
479+
480+ To interact with the ``mymongo.example.net:27017`` cluster, issue
481+ operations against the ``cluster`` object. For a full list of Stable API
482+ commands, see :ref:`<api-v1-command-list>`.
0 commit comments