@@ -7,15 +7,15 @@ Mongo()
7
7
.. contents:: On this page
8
8
:local:
9
9
:backlinks: none
10
- :depth: 1
10
+ :depth: 2
11
11
:class: singlecol
12
12
13
13
Description
14
14
-----------
15
15
16
16
.. versionchanged:: 4.2
17
17
18
- .. method:: Mongo(host, ClientSideFieldLevelEncryptionOptions)
18
+ .. method:: Mongo(host, ClientSideFieldLevelEncryptionOptions, api )
19
19
20
20
JavaScript constructor to instantiate a database connection from
21
21
:binary:`~bin.mongosh` or from a JavaScript file.
@@ -36,21 +36,19 @@ Description
36
36
37
37
- string
38
38
39
- - Optional. The host, either in the form of ``<host>`` or
39
+ - * Optional* . The host, either in the form of ``<host>`` or
40
40
``<host><:port>``.
41
41
42
42
If omitted, :method:`Mongo` instantiates a connection to the
43
43
localhost interface on the default port ``27017``.
44
44
45
45
* - ``ClientSideFieldLevelEncryptionOptions``
46
46
47
- - Document
47
+ - document
48
48
49
- - *Optional*
50
-
51
- .. versionadded:: 4.2
49
+ - .. versionadded:: 4.2
52
50
53
- Configuration parameters for enabling
51
+ *Optional*. Configuration parameters for enabling
54
52
:doc:`/core/security-client-side-encryption`.
55
53
56
54
``ClientSideFieldLevelEncryptionOptions`` overrides the
@@ -59,8 +57,16 @@ Description
59
57
inherits the client-side field level encryption configuration
60
58
of the current database connection.
61
59
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.
64
70
65
71
.. seealso::
66
72
@@ -254,9 +260,31 @@ following parameters:
254
260
level encryption rules and perform explicit (manual) per-field
255
261
encryption.
256
262
257
- Example
263
+ .. _mongo-api-options:
264
+
265
+ ``api``
258
266
-------
259
267
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
+
260
288
Connect to a MongoDB Cluster
261
289
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262
290
@@ -277,8 +305,8 @@ Issue operations against the ``cluster`` object to interact with the
277
305
278
306
.. _mongo-connection-client-side-encryption-enabled:
279
307
280
- Connect to a MongoDB Cluster with Client-Side Encryption Enabled
281
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308
+ Connect to a Cluster with Client-Side Encryption Enabled
309
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
282
310
283
311
Configuring client-side field level encryption for a :ref:`locally
284
312
managed key <field-level-encryption-local-kms>` requires specifying a
@@ -338,8 +366,8 @@ a complete list of client-side field level encryption methods.
338
366
339
367
.. _mongo-connection-automatic-client-side-encryption-enabled:
340
368
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
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
343
371
344
372
Configuring client-side field level encryption for a :ref:`locally
345
373
managed key <field-level-encryption-local-kms>` requires specifying a
@@ -424,3 +452,23 @@ the specified data encryption key can decrypt the field.
424
452
425
453
See :doc:`/reference/method/js-client-side-field-level-encryption` for
426
454
a 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