@@ -356,6 +356,56 @@ Connection Methods
356
356
357
357
- Description
358
358
359
+ * - :method:`Mongo()`
360
+
361
+ - JavaScript constructor to instantiate a database connection from
362
+ the ``mongo`` shell or from a JavaScript file.
363
+
364
+ The :method:`Mongo()` method has the following parameters:
365
+
366
+ .. list-table::
367
+ :header-rows: 1
368
+ :widths: 20 20 80
369
+
370
+ * - Parameter
371
+
372
+ - Type
373
+
374
+ - Description
375
+
376
+ * - ``host``
377
+
378
+ - string
379
+
380
+ - *Optional*
381
+
382
+ The connection string for the target database
383
+ connection.
384
+
385
+ If omitted, :method:`Mongo` instantiates a connection to the
386
+ localhost interface on the default port ``27017``.
387
+
388
+ * - ``ClientSideFieldLevelEncryptionOptions``
389
+
390
+ - Document
391
+
392
+ - *Optional*
393
+
394
+ .. versionadded:: 4.2
395
+
396
+ Configuration parameters for enabling
397
+ :manual:`Client-Side Field Level Encryption
398
+ </core/security-client-side-encryption>`.
399
+
400
+ ``ClientSideFieldLevelEncryptionOptions`` overrides the
401
+ existing client-side field level encryption configuration of
402
+ the database connection. If omitted, :method:`Mongo()`
403
+ inherits the client-side field level encryption configuration
404
+ of the current database connection.
405
+
406
+ For documentation of usage and syntax, see
407
+ :ref:`ClientSideFieldLevelEncryptionOptions`.
408
+
359
409
* - :method:`Mongo.getDB()`
360
410
361
411
- Returns a database object.
@@ -366,7 +416,7 @@ Connection Methods
366
416
367
417
* - :method:`Mongo.watch()`
368
418
369
- - Opens a :manual:`change stream cursor </change-streams >` for a replica
419
+ - Opens a :manual:`change stream cursor </changeStreams >` for a replica
370
420
set or a sharded cluster to report on all its non-system collections
371
421
across its databases, with the exception of the ``admin``, ``local``,
372
422
and ``config`` databases.
@@ -691,6 +741,89 @@ standalone and replica set deployments.
691
741
692
742
- Returns the free cloud monitoring status for your deployment.
693
743
744
+ Client-Side Field Level Encryption Methods
745
+ ------------------------------------------
746
+
747
+ .. note:: Limitations
748
+
749
+ - Automatic encryption is only available when ``mongosh`` is connected
750
+ to an Atlas cluster or a MongoDB Enterprise Server. For details,
751
+ see :manual:`Automatic Client-Side Field Level Encryption
752
+ </core/security-automatic-client-side-encryption/>`. The methods
753
+ listed in this section are used for *manual* encryption, and are
754
+ supported on non-enterprise servers.
755
+
756
+ - Automatic encryption is not available with the Homebrew installation
757
+ of ``mongosh``.
758
+
759
+ - Field level encryption is only available in the ``mongosh`` binary,
760
+ and not available in the :compass:`embedded Compass shell
761
+ </embedded-shell>`.
762
+
763
+ .. list-table::
764
+ :widths: 30 70
765
+ :header-rows: 1
766
+
767
+ * - Method
768
+
769
+ - Description
770
+
771
+ * - :method:`ClientEncryption.decrypt()`
772
+
773
+ - Decrypts the specified ``encryptedValue`` if the current database
774
+ connection was configured with access to the Key Management Service
775
+ (KMS) and key vault used to encrypt ``encryptedValue``.
776
+
777
+ * - :method:`ClientEncryption.encrypt()`
778
+
779
+ - Encrypts the specified value using the specified ``encryptionKeyId``
780
+ and ``encryptionAlgorithm``.
781
+
782
+ * - :method:`getClientEncryption()`
783
+
784
+ - Returns the ``ClientEncryption`` object for the current database
785
+ collection.
786
+
787
+ * - :method:`getKeyVault()`
788
+
789
+ - Returns the ``KeyVault`` object for the current database connection.
790
+
791
+ * - :method:`KeyVault.addKeyAlternateName()`
792
+
793
+ - Adds the ``keyAltName`` to the ``keyAltNames`` array of the data
794
+ encryption key with the specified UUID.
795
+
796
+ * - :method:`KeyVault.createKey()`
797
+
798
+ - Adds a data encryption key to the key vault associated to the
799
+ database connection.
800
+
801
+ * - :method:`KeyVault.deleteKey()`
802
+
803
+ - Deletes a data encryption key with the specified UUID from the key
804
+ vault associated to the database connection.
805
+
806
+ * - :method:`KeyVault.getKey()`
807
+
808
+ - Gets a data encryption key with the specified UUID. The data
809
+ encryption key must exist in the key vault associated to the
810
+ database connection.
811
+
812
+ * - :method:`KeyVault.getKeyByAltName()`
813
+
814
+ - Gets all data encryption keys with the specified ``keyAltName``.
815
+
816
+ * - :method:`KeyVault.getKeys()`
817
+
818
+ - Returns all data encryption keys stored in the key vault associated
819
+ to the database connection.
820
+
821
+ * - :method:`KeyVault.removeKeyAlternateName()`
822
+
823
+ - Removes the specified ``keyAltName`` from the data encryption key
824
+ with the specified UUID. The data encryption key must exist in the
825
+ key vault associated to the database connection.
826
+
694
827
Native Methods
695
828
--------------
696
829
0 commit comments