Skip to content

Commit 79821cd

Browse files
DOCSP-31067 QE Sample apps add POJOs (#4229)
* testing nested tab * test adding POJO samples * test adding POJO samples * test steps * test steps * test steps * Add steps to find * typo * update app * remove bsondocument from java app * change to pojo in all tutorials * Chris feedback * typos * Chris feedback second review
1 parent 109d271 commit 79821cd

File tree

11 files changed

+414
-98
lines changed

11 files changed

+414
-98
lines changed

source/core/queryable-encryption/quick-start.txt

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ Procedure
399399
:start-after: start-get-local-key
400400
:end-before: end-get-local-key
401401
:language: java
402-
:emphasize-lines: 7-11
402+
:emphasize-lines: 9-13
403403
:dedent:
404404

405405
.. tab::
@@ -953,15 +953,15 @@ Procedure
953953

954954
.. step:: Insert a Document with Encrypted Fields
955955

956-
Create a sample document that describes a patient's personal information.
957-
Use the encrypted client to insert it into the ``patients`` collection,
958-
as shown in the following example:
959-
960956
.. tabs-drivers::
961957

962958
.. tab::
963959
:tabid: shell
964960

961+
Create a sample document that describes a patient's personal information.
962+
Use the encrypted client to insert it into the ``patients`` collection,
963+
as shown in the following example:
964+
965965
.. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
966966
:start-after: start-insert-document
967967
:end-before: end-insert-document
@@ -972,6 +972,10 @@ Procedure
972972
.. tab::
973973
:tabid: nodejs
974974

975+
Create a sample document that describes a patient's personal information.
976+
Use the encrypted client to insert it into the ``patients`` collection,
977+
as shown in the following example:
978+
975979
.. literalinclude:: /includes/qe-tutorials/node/queryable-encryption-tutorial.js
976980
:start-after: start-insert-document
977981
:end-before: end-insert-document
@@ -982,6 +986,10 @@ Procedure
982986
.. tab::
983987
:tabid: python
984988

989+
Create a sample document that describes a patient's personal information.
990+
Use the encrypted client to insert it into the ``patients`` collection,
991+
as shown in the following example:
992+
985993
.. literalinclude:: /includes/qe-tutorials/python/queryable_encryption_tutorial.py
986994
:start-after: start-insert-document
987995
:end-before: end-insert-document
@@ -992,16 +1000,47 @@ Procedure
9921000
.. tab::
9931001
:tabid: java-sync
9941002

1003+
This tutorial uses POJOs as data models
1004+
to represent the document structure. To set up your application to
1005+
use POJOs, add the following code:
1006+
1007+
.. literalinclude:: /includes/qe-tutorials/java/src/main/java/com/mongodb/tutorials/qe/QueryableEncryptionTutorial.java
1008+
:start-after: start-setup-application-pojo
1009+
:end-before: end-setup-application-pojo
1010+
:language: java
1011+
:dedent:
1012+
1013+
To learn more about Java POJOs, see the `Plain Old Java Object
1014+
wikipedia article <https://en.wikipedia.org/wiki/Plain_old_Java_object>`__.
1015+
1016+
This tutorial uses the following POJOs:
1017+
1018+
- ``Patient``
1019+
- ``PatientRecord``
1020+
- ``PatientBilling``
1021+
1022+
You can view these classes in the `models package of the complete Java application
1023+
<{+sample-app-url-qe+}/java/src/main/java/com/mongodb/tutorials/qe/models>`__.
1024+
1025+
Add these POJO classes to your application. Then, create an instance
1026+
of a ``Patient`` that describes a patient's personal information. Use
1027+
the encrypted client to insert it into the ``patients`` collection,
1028+
as shown in the following example:
1029+
9951030
.. literalinclude:: /includes/qe-tutorials/java/src/main/java/com/mongodb/tutorials/qe/QueryableEncryptionTutorial.java
9961031
:start-after: start-insert-document
9971032
:end-before: end-insert-document
998-
:emphasize-lines: 14
1033+
:emphasize-lines: 8
9991034
:language: java
1000-
:dedent:
1035+
:dedent:
10011036

10021037
.. tab::
10031038
:tabid: go
10041039

1040+
Create a sample document that describes a patient's personal information.
1041+
Use the encrypted client to insert it into the ``patients`` collection,
1042+
as shown in the following example:
1043+
10051044
.. literalinclude:: /includes/qe-tutorials/go/queryable_encryption_tutorial.go
10061045
:start-after: start-insert-document
10071046
:end-before: end-insert-document
@@ -1012,6 +1051,10 @@ Procedure
10121051
.. tab::
10131052
:tabid: csharp
10141053

1054+
Create a sample document that describes a patient's personal information.
1055+
Use the encrypted client to insert it into the ``patients`` collection,
1056+
as shown in the following example:
1057+
10151058
.. literalinclude:: /includes/qe-tutorials/csharp/QueryableEncryptionTutorial.cs
10161059
:start-after: start-insert-document
10171060
:end-before: end-insert-document
@@ -1021,8 +1064,8 @@ Procedure
10211064

10221065
.. step:: Query on an Encrypted Field
10231066

1024-
The following code sample uses a ``MongoClient`` configured for automatic {+qe+}
1025-
to query on an encrypted field and view the decrypted data:
1067+
The following code sample executes a find query on an encrypted field and
1068+
prints the decrypted data:
10261069

10271070
.. tabs-drivers::
10281071

@@ -1032,7 +1075,6 @@ Procedure
10321075
.. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
10331076
:start-after: start-find-document
10341077
:end-before: end-find-document
1035-
:emphasize-lines: 1-3
10361078
:language: javascript
10371079
:dedent:
10381080

@@ -1042,7 +1084,6 @@ Procedure
10421084
.. literalinclude:: /includes/qe-tutorials/node/queryable-encryption-tutorial.js
10431085
:start-after: start-find-document
10441086
:end-before: end-find-document
1045-
:emphasize-lines: 1-3
10461087
:language: javascript
10471088
:dedent:
10481089

@@ -1052,7 +1093,6 @@ Procedure
10521093
.. literalinclude:: /includes/qe-tutorials/python/queryable_encryption_tutorial.py
10531094
:start-after: start-find-document
10541095
:end-before: end-find-document
1055-
:emphasize-lines: 1-3
10561096
:language: python
10571097
:dedent:
10581098

@@ -1062,7 +1102,6 @@ Procedure
10621102
.. literalinclude:: /includes/qe-tutorials/java/src/main/java/com/mongodb/tutorials/qe/QueryableEncryptionTutorial.java
10631103
:start-after: start-find-document
10641104
:end-before: end-find-document
1065-
:emphasize-lines: 1-3
10661105
:language: java
10671106
:dedent:
10681107

@@ -1072,7 +1111,6 @@ Procedure
10721111
.. literalinclude:: /includes/qe-tutorials/go/queryable_encryption_tutorial.go
10731112
:start-after: start-find-document
10741113
:end-before: end-find-document
1075-
:emphasize-lines: 2-5
10761114
:language: go
10771115
:dedent:
10781116

@@ -1082,7 +1120,6 @@ Procedure
10821120
.. literalinclude:: /includes/qe-tutorials/csharp/QueryableEncryptionTutorial.cs
10831121
:start-after: start-find-document
10841122
:end-before: end-find-document
1085-
:emphasize-lines: 2
10861123
:language: csharp
10871124
:dedent:
10881125

source/core/queryable-encryption/tutorials/aws/aws-automatic.txt

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -895,15 +895,15 @@ Create the Application
895895

896896
.. step:: Insert a Document with Encrypted Fields
897897

898-
Create a sample document that describes a patient's personal information.
899-
Use the encrypted client to insert it into the ``patients`` collection,
900-
as shown in the following example:
901-
902898
.. tabs-drivers::
903899

904900
.. tab::
905901
:tabid: shell
906902

903+
Create a sample document that describes a patient's personal information.
904+
Use the encrypted client to insert it into the ``patients`` collection,
905+
as shown in the following example:
906+
907907
.. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
908908
:start-after: start-insert-document
909909
:end-before: end-insert-document
@@ -914,6 +914,10 @@ Create the Application
914914
.. tab::
915915
:tabid: nodejs
916916

917+
Create a sample document that describes a patient's personal information.
918+
Use the encrypted client to insert it into the ``patients`` collection,
919+
as shown in the following example:
920+
917921
.. literalinclude:: /includes/qe-tutorials/node/queryable-encryption-tutorial.js
918922
:start-after: start-insert-document
919923
:end-before: end-insert-document
@@ -924,6 +928,10 @@ Create the Application
924928
.. tab::
925929
:tabid: python
926930

931+
Create a sample document that describes a patient's personal information.
932+
Use the encrypted client to insert it into the ``patients`` collection,
933+
as shown in the following example:
934+
927935
.. literalinclude:: /includes/qe-tutorials/python/queryable_encryption_tutorial.py
928936
:start-after: start-insert-document
929937
:end-before: end-insert-document
@@ -934,16 +942,47 @@ Create the Application
934942
.. tab::
935943
:tabid: java-sync
936944

945+
This tutorial uses POJOs as data models
946+
to represent the document structure. To set up your application to
947+
use POJOs, add the following code:
948+
949+
.. literalinclude:: /includes/qe-tutorials/java/src/main/java/com/mongodb/tutorials/qe/QueryableEncryptionTutorial.java
950+
:start-after: start-setup-application-pojo
951+
:end-before: end-setup-application-pojo
952+
:language: java
953+
:dedent:
954+
955+
To learn more about Java POJOs, see the `Plain Old Java Object
956+
wikipedia article <https://en.wikipedia.org/wiki/Plain_old_Java_object>`__.
957+
958+
This tutorial uses the following POJOs:
959+
960+
- ``Patient``
961+
- ``PatientRecord``
962+
- ``PatientBilling``
963+
964+
You can view these classes in the `models package of the complete Java application
965+
<{+sample-app-url-qe+}/java/src/main/java/com/mongodb/tutorials/qe/models>`__.
966+
967+
Add these POJO classes to your application. Then, create an instance
968+
of a ``Patient`` that describes a patient's personal information. Use
969+
the encrypted client to insert it into the ``patients`` collection,
970+
as shown in the following example:
971+
937972
.. literalinclude:: /includes/qe-tutorials/java/src/main/java/com/mongodb/tutorials/qe/QueryableEncryptionTutorial.java
938973
:start-after: start-insert-document
939974
:end-before: end-insert-document
940-
:emphasize-lines: 14
975+
:emphasize-lines: 8
941976
:language: java
942-
:dedent:
977+
:dedent:
943978

944979
.. tab::
945980
:tabid: go
946981

982+
Create a sample document that describes a patient's personal information.
983+
Use the encrypted client to insert it into the ``patients`` collection,
984+
as shown in the following example:
985+
947986
.. literalinclude:: /includes/qe-tutorials/go/queryable_encryption_tutorial.go
948987
:start-after: start-insert-document
949988
:end-before: end-insert-document
@@ -954,6 +993,10 @@ Create the Application
954993
.. tab::
955994
:tabid: csharp
956995

996+
Create a sample document that describes a patient's personal information.
997+
Use the encrypted client to insert it into the ``patients`` collection,
998+
as shown in the following example:
999+
9571000
.. literalinclude:: /includes/qe-tutorials/csharp/QueryableEncryptionTutorial.cs
9581001
:start-after: start-insert-document
9591002
:end-before: end-insert-document
@@ -963,8 +1006,8 @@ Create the Application
9631006

9641007
.. step:: Query on an Encrypted Field
9651008

966-
The following code sample uses a ``MongoClient`` configured for automatic {+qe+}
967-
to query on an encrypted field and view the decrypted data:
1009+
The following code sample executes a find query on an encrypted field and
1010+
prints the decrypted data:
9681011

9691012
.. tabs-drivers::
9701013

@@ -974,7 +1017,6 @@ Create the Application
9741017
.. literalinclude:: /includes/qe-tutorials/mongosh/queryable-encryption-tutorial.js
9751018
:start-after: start-find-document
9761019
:end-before: end-find-document
977-
:emphasize-lines: 1-3
9781020
:language: javascript
9791021
:dedent:
9801022

@@ -984,7 +1026,6 @@ Create the Application
9841026
.. literalinclude:: /includes/qe-tutorials/node/queryable-encryption-tutorial.js
9851027
:start-after: start-find-document
9861028
:end-before: end-find-document
987-
:emphasize-lines: 1-3
9881029
:language: javascript
9891030
:dedent:
9901031

@@ -994,7 +1035,6 @@ Create the Application
9941035
.. literalinclude:: /includes/qe-tutorials/python/queryable_encryption_tutorial.py
9951036
:start-after: start-find-document
9961037
:end-before: end-find-document
997-
:emphasize-lines: 1-3
9981038
:language: python
9991039
:dedent:
10001040

@@ -1004,7 +1044,6 @@ Create the Application
10041044
.. literalinclude:: /includes/qe-tutorials/java/src/main/java/com/mongodb/tutorials/qe/QueryableEncryptionTutorial.java
10051045
:start-after: start-find-document
10061046
:end-before: end-find-document
1007-
:emphasize-lines: 1-3
10081047
:language: java
10091048
:dedent:
10101049

@@ -1014,7 +1053,6 @@ Create the Application
10141053
.. literalinclude:: /includes/qe-tutorials/go/queryable_encryption_tutorial.go
10151054
:start-after: start-find-document
10161055
:end-before: end-find-document
1017-
:emphasize-lines: 2-5
10181056
:language: go
10191057
:dedent:
10201058

@@ -1024,7 +1062,6 @@ Create the Application
10241062
.. literalinclude:: /includes/qe-tutorials/csharp/QueryableEncryptionTutorial.cs
10251063
:start-after: start-find-document
10261064
:end-before: end-find-document
1027-
:emphasize-lines: 2
10281065
:language: csharp
10291066
:dedent:
10301067

0 commit comments

Comments
 (0)