@@ -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, ClientSideFieldLevelEncryptionOptions)
18+ .. method:: Mongo(host, ClientSideFieldLevelEncryptionOptions, 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 * - ``ClientSideFieldLevelEncryptionOptions``
4646
47- - Document
47+ - document
4848
49- - *Optional*
50-
51- .. versionadded:: 4.2
49+ - .. versionadded:: 4.2
5250
53- Configuration parameters for enabling
51+ *Optional*. Configuration parameters for enabling
5452 :doc:`/core/security-client-side-encryption`.
5553
5654 ``ClientSideFieldLevelEncryptionOptions`` overrides the
@@ -59,8 +57,16 @@ 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:`ClientSideFieldLevelEncryptionOptions`.
60+ See :ref:`ClientSideFieldLevelEncryptionOptions` for usage and syntax details.
61+
62+ * - ``api``
63+
64+ - document
65+
66+ - *Optional*. Configuration options for enabling the
67+ :ref:`Stable API <stable-api>`.
68+
69+ See :ref:`mongo-api-options` for usage and syntax details.
6470
6571.. seealso::
6672
@@ -254,9 +260,31 @@ following parameters:
254260 level encryption rules and perform explicit (manual) per-field
255261 encryption.
256262
257- Example
263+ .. _mongo-api-options:
264+
265+ ``api``
258266-------
259267
268+ The ``api`` parameter specifies configuration options for the
269+ :ref:`Stable API <stable-api>`. You can enable or disable optional
270+ behavior using the following options:
271+
272+ .. include:: /includes/stable-api-options.rst
273+
274+ .. |param| replace:: Option
275+ .. |apiVersion| replace:: ``version``
276+ .. |strict| replace:: ``strict``
277+ .. |deprecation| replace:: ``deprecationErrors``
278+
279+ The ``api`` parameter has the following syntax:
280+
281+ .. code-block:: javascript
282+
283+ { api: { version: <string>, strict: <boolean>, deprecationErrors: <boolean> } }
284+
285+ Examples
286+ --------
287+
260288Connect to a MongoDB Cluster
261289~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262290
@@ -277,8 +305,8 @@ Issue operations against the ``cluster`` object to interact with the
277305
278306.. _mongo-connection-client-side-encryption-enabled:
279307
280- Connect to a MongoDB Cluster with Client-Side Encryption Enabled
281- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308+ Connect to a Cluster with Client-Side Encryption Enabled
309+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
282310
283311Configuring client-side field level encryption for a :ref:`locally
284312managed key <field-level-encryption-local-kms>` requires specifying a
@@ -338,8 +366,8 @@ a complete list of client-side field level encryption methods.
338366
339367.. _mongo-connection-automatic-client-side-encryption-enabled:
340368
341- Connect to a MongoDB Cluster with Automatic Client-Side Encryption Enabled
342- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
369+ Connect to a Cluster with Automatic Client-Side Encryption Enabled
370+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
343371
344372Configuring client-side field level encryption for a :ref:`locally
345373managed key <field-level-encryption-local-kms>` requires specifying a
@@ -424,3 +452,23 @@ the specified data encryption key can decrypt the field.
424452
425453See :doc:`/reference/method/js-client-side-field-level-encryption` for
426454a complete list of client-side field level encryption methods.
455+
456+ Connect to a Cluster with the Stable API Enabled
457+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
458+
459+ The following operation creates a new connection object from within a
460+ :binary:`~bin.mongosh` session. The :ref:`mongo-api-options` option
461+ enables Stable API V1 and specifies that you cannot
462+ run deprecated command or commands outside of the Stable API.
463+
464+ .. code-block:: javascript
465+
466+ cluster = Mongo(
467+ "mongodb://mymongo.example.net:27017/?replicaSet=myMongoCluster",
468+ null,
469+ { api: { version: "1", strict: true, deprecationErrors: true } }
470+ )
471+
472+ To interact with the ``mymongo.example.net:27017`` cluster, issue
473+ operations against the ``cluster`` object. For a full list of Stable API
474+ commands, see :ref:`<api-v1-command-list>`.
0 commit comments