@@ -41,6 +41,11 @@ Before You Get Started
4141
4242 .. tabs::
4343
44+ .. tab:: mongosh
45+ :tabid: shell
46+
47+ `Complete mongosh Application <{+sample-app-url-qe+}/mongosh/>`__
48+
4449 .. tab:: Node.js
4550 :tabid: nodejs
4651
@@ -83,6 +88,35 @@ Procedure
8388
8489 .. tabs-drivers::
8590
91+ .. tab::
92+ :tabid: shell
93+
94+ - **kmsProviderName** - The KMS you're using to store your {+cmk-long+}.
95+ Set this variable to ``"local"`` for this tutorial.
96+ - **uri** - Your MongoDB deployment connection URI. Set your connection
97+ URI in the ``MONGODB_URI`` environment variable or replace the value
98+ directly.
99+ - **keyVaultDatabaseName** - The database in MongoDB where your data
100+ encryption keys (DEKs) will be stored. Set this variable
101+ to ``"encryption"``.
102+ - **keyVaultCollectionName** - The collection in MongoDB where your DEKs
103+ will be stored. Set this variable to ``"__keyVault"``.
104+ - **keyVaultNamespace** - The namespace in MongoDB where your DEKs will
105+ be stored. Set this variable to the values of the ``keyVaultDatabaseName``
106+ and ``keyVaultCollectionName`` variables, separated by a period.
107+ - **encryptedDatabaseName** - The database in MongoDB where your encrypted
108+ data will be stored. Set this variable to ``"medicalRecords"``.
109+ - **encryptedCollectionName** - The collection in MongoDB where your encrypted
110+ data will be stored. Set this variable to ``"patients"``.
111+
112+ You can declare these variables by using the following code:
113+
114+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
115+ :start-after: // start-setup-application-variables
116+ :end-before: // end-setup-application-variables
117+ :language: javascript
118+ :dedent:
119+
86120 .. tab::
87121 :tabid: nodejs
88122
@@ -255,6 +289,15 @@ Procedure
255289
256290 .. tabs-drivers::
257291
292+ .. tab::
293+ :tabid: shell
294+
295+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-helpers.js
296+ :start-after: start-generate-local-key
297+ :end-before: end-generate-local-key
298+ :language: javascript
299+ :dedent:
300+
258301 .. tab::
259302 :tabid: nodejs
260303
@@ -319,6 +362,15 @@ Procedure
319362
320363 .. tabs-drivers::
321364
365+ .. tab::
366+ :tabid: shell
367+
368+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-helpers.js
369+ :start-after: start-get-local-key
370+ :end-before: end-get-local-key
371+ :language: javascript
372+ :dedent:
373+
322374 .. tab::
323375 :tabid: nodejs
324376
@@ -372,6 +424,18 @@ Procedure
372424
373425 .. tabs-drivers::
374426
427+ .. tab::
428+ :tabid: shell
429+
430+ - The variable containing your Local KMS credentials
431+ - The namespace of your {+key-vault-long+}
432+
433+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-helpers.js
434+ :start-after: // start-auto-encryption-options
435+ :end-before: // end-auto-encryption-options
436+ :language: javascript
437+ :dedent:
438+
375439 .. tab::
376440 :tabid: nodejs
377441
@@ -447,6 +511,15 @@ Procedure
447511
448512 .. tabs-drivers::
449513
514+ .. tab::
515+ :tabid: shell
516+
517+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
518+ :start-after: // start-create-client
519+ :end-before: // end-create-client
520+ :language: javascript
521+ :dedent:
522+
450523 .. tab::
451524 :tabid: nodejs
452525
@@ -502,6 +575,15 @@ Procedure
502575
503576 .. tabs-drivers::
504577
578+ .. tab::
579+ :tabid: shell
580+
581+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
582+ :start-after: // start-encrypted-fields-map
583+ :end-before: // end-encrypted-fields-map
584+ :language: javascript
585+ :dedent:
586+
505587 .. tab::
506588 :tabid: nodejs
507589
@@ -555,13 +637,22 @@ Procedure
555637
556638 .. step:: Create the Collection
557639
640+ Instantiate ``ClientEncryption`` to access the API for the
641+ encryption helper methods.
642+
558643 .. tabs-drivers::
559644
560645 .. tab::
561- :tabid: nodejs
646+ :tabid: shell
562647
563- Instantiate ``ClientEncryption`` to access the API for the
564- encryption helper methods.
648+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
649+ :start-after: // start-client-encryption
650+ :end-before: // end-client-encryption
651+ :language: javascript
652+ :dedent:
653+
654+ .. tab::
655+ :tabid: nodejs
565656
566657 .. literalinclude:: /includes/qe-tutorials/node/queryable-encryption-helpers.js
567658 :start-after: // start-client-encryption
@@ -572,9 +663,6 @@ Procedure
572663 .. tab::
573664 :tabid: python
574665
575- Instantiate ``ClientEncryption`` to access the API for the
576- encryption helper methods.
577-
578666 .. literalinclude:: /includes/qe-tutorials/python/queryable_encryption_helpers.py
579667 :start-after: # start-client-encryption
580668 :end-before: # end-client-encryption
@@ -584,9 +672,6 @@ Procedure
584672 .. tab::
585673 :tabid: java-sync
586674
587- Instantiate ``ClientEncryption`` to access the API for the
588- encryption helper methods.
589-
590675 .. literalinclude:: /includes/qe-tutorials/java/src/main/java/com/mongodb/tutorials/qe/QueryableEncryptionTutorial.java
591676 :start-after: // start-client-encryption
592677 :end-before: // end-client-encryption
@@ -596,9 +681,6 @@ Procedure
596681 .. tab::
597682 :tabid: go
598683
599- Instantiate ``ClientEncryption`` to access the API for the
600- encryption helper methods.
601-
602684 .. literalinclude:: /includes/qe-tutorials/go/queryable_encryption_helpers.go
603685 :start-after: // start-client-encryption
604686 :end-before: // end-client-encryption
@@ -608,9 +690,6 @@ Procedure
608690 .. tab::
609691 :tabid: csharp
610692
611- Instantiate ``ClientEncryption`` to access the API for the
612- encryption helper methods.
613-
614693 .. literalinclude:: /includes/qe-tutorials/csharp/QueryableEncryptionHelpers.cs
615694 :start-after: // start-client-encryption
616695 :end-before: // end-client-encryption
@@ -624,6 +703,15 @@ Procedure
624703
625704 .. tabs-drivers::
626705
706+ .. tab::
707+ :tabid: shell
708+
709+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-helpers.js
710+ :start-after: start-kmip-local-cmk-credentials
711+ :end-before: end-kmip-local-cmk-credentials
712+ :language: javascript
713+ :dedent:
714+
627715 .. tab::
628716 :tabid: nodejs
629717
@@ -671,6 +759,20 @@ Procedure
671759
672760 .. tabs-drivers::
673761
762+ .. tab::
763+ :tabid: shell
764+
765+ Create your encrypted collection by using the encryption
766+ helper method accessed through the ``ClientEncryption`` class.
767+ This method automatically generates data encryption keys for your
768+ encrypted fields and creates the encrypted collection:
769+
770+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
771+ :start-after: // start-create-encrypted-collection
772+ :end-before: // end-create-encrypted-collection
773+ :language: javascript
774+ :dedent:
775+
674776 .. tab::
675777 :tabid: nodejs
676778
@@ -760,8 +862,8 @@ Procedure
760862 After you've added these classes, create your encrypted
761863 collection by using the encryption helper method accessed
762864 through the ``ClientEncryption`` class.
763- This method automatically generates data encryption keys for
764- your encrypted fields and creates the encrypted collection:
865+ This method automatically generates data encryption keys for your
866+ encrypted fields and creates the encrypted collection:
765867
766868 .. literalinclude:: /includes/qe-tutorials/go/queryable_encryption_tutorial.go
767869 :start-after: // start-create-encrypted-collection
@@ -779,7 +881,7 @@ Procedure
779881 :tabid: csharp
780882
781883 The C# version of this tutorial uses separate classes as data models
782- when creating the encrypted collection .
884+ to represent the document structure .
783885 Add the following ``Patient``, ``PatientRecord``, and ``PatientBilling``
784886 classes to your project:
785887
@@ -827,6 +929,15 @@ Procedure
827929
828930 .. tabs-drivers::
829931
932+ .. tab::
933+ :tabid: shell
934+
935+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
936+ :start-after: // start-insert-document
937+ :end-before: // end-insert-document
938+ :language: javascript
939+ :dedent:
940+
830941 .. tab::
831942 :tabid: nodejs
832943
@@ -879,6 +990,15 @@ Procedure
879990
880991 .. tabs-drivers::
881992
993+ .. tab::
994+ :tabid: shell
995+
996+ .. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
997+ :start-after: // start-find-document
998+ :end-before: // end-find-document
999+ :language: javascript
1000+ :dedent:
1001+
8821002 .. tab::
8831003 :tabid: nodejs
8841004
0 commit comments