Skip to content

Commit 91a2c4f

Browse files
author
Chris Cho
authored
fixes to CSFLE use-case guide (#544)
* fixes to CSFLE use-case guide
1 parent 08b506a commit 91a2c4f

File tree

5 files changed

+497
-302
lines changed

5 files changed

+497
-302
lines changed

source/includes/steps-create-data-encryption-key.yaml

Lines changed: 0 additions & 160 deletions
This file was deleted.

source/includes/steps-fle-configure-the-mongodb-client.yaml

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ content: |
66
``encryption.__keyVault`` as the key vault.
77
88
.. tabs-drivers::
9-
9+
1010
.. tab::
1111
:tabid: java-sync
12-
12+
1313
.. code-block:: java
14-
14+
1515
String keyVaultNamespace = "encryption.__keyVault";
1616
.. tab::
1717
:tabid: nodejs
18-
18+
1919
.. code-block:: javascript
20-
20+
2121
const keyVaultNamespace = "encryption.__keyVault";
2222
---
2323
title: Specify the Local Master Encryption Key
@@ -29,29 +29,29 @@ content: |
2929
inline.
3030
3131
.. tabs-drivers::
32-
32+
3333
.. tab::
3434
:tabid: java-sync
35-
35+
3636
.. code-block:: java
3737
:emphasize-lines: 2,3
38-
38+
3939
Map<String, Map<String, Object>> kmsProviders = new HashMap<String, Map<String, Object>>() {{
4040
put("local", new HashMap<String, Object>() {{
4141
put("key", localMasterKey);
4242
}});
4343
}};
4444
.. tab::
4545
:tabid: nodejs
46-
46+
4747
.. code-block:: javascript
48-
48+
:emphasize-lines: 2,3
49+
4950
const kmsProviders = {
5051
local: {
51-
key: localMasterKey
52+
key: localMasterKey,
5253
}
5354
}
54-
5555
---
5656
title: Map the JSON Schema to the Patients Collection
5757
ref: map-the-json-schema-to-the-patients-collection
@@ -61,24 +61,24 @@ content: |
6161
the ``medicalRecords.patients`` collection namespace:
6262
6363
.. tabs-drivers::
64-
64+
6565
.. tab::
6666
:tabid: java-sync
67-
67+
6868
.. code-block:: java
6969
:emphasize-lines: 2
70-
70+
7171
HashMap<String, BsonDocument> schemaMap = new HashMap<String, BsonDocument>() {{
7272
put("medicalRecords.patients", BsonDocument.parse(jsonSchema));
7373
}}
7474
.. tab::
7575
:tabid: nodejs
76-
76+
7777
.. code-block:: javascript
78-
79-
const dataNamespace = "medicalRecords.patients";
78+
:emphasize-lines: 2
79+
8080
const patientSchema = {
81-
[dataNamespace]: jsonSchema
81+
"medicalRecords.patients": jsonSchema,
8282
}
8383
---
8484
title: Specify the Location of the Encryption Binary
@@ -87,55 +87,55 @@ content: |
8787
MongoDB drivers use the ``mongocryptd`` binary to perform client-side
8888
encryption. For automatic encryption, the client manages the
8989
``mongocryptd`` process. To configure the client to find the binary,
90-
MedcoMD specifies the binary's path as an extra option:
91-
90+
Specify the path to the binary using the following configuration:
91+
9292
.. tabs-drivers::
93-
93+
9494
.. tab::
9595
:tabid: java-sync
96-
96+
9797
.. code-block:: java
9898
:emphasize-lines: 2
99-
99+
100100
final Map<String, Object> extraOptions = new HashMap<String, Object>() {{
101-
put("mongocryptdPath", "/usr/local/bin/mongocryptd");
101+
put("mongocryptdSpawnPath", "/usr/local/bin/mongocryptd");
102102
}};
103-
103+
104104
.. admonition:: Encryption Binary Daemon
105105
:class: note
106-
106+
107107
If the ``mongocryptd`` daemon is already running, you can
108108
configure the client to skip starting it by passing the
109109
following option:
110-
110+
111111
.. code-block:: java
112112
:emphasize-lines: 2
113-
113+
114114
final Map<String, Object> extraOptions = new HashMap<String, Object>() {{
115115
put("mongocryptdBypassSpawn", true);
116116
}};
117117
.. tab::
118118
:tabid: nodejs
119-
119+
120120
.. code-block:: javascript
121121
:emphasize-lines: 2
122-
122+
123123
const extraOptions = {
124-
mongocryptdPath: "/usr/local/bin/mongocryptd";
124+
mongocryptdSpawnPath: "/usr/local/bin/mongocryptd",
125125
}
126-
126+
127127
.. admonition:: Encryption Binary Daemon
128128
:class: note
129-
129+
130130
If the ``mongocryptd`` daemon is already running, you can
131131
configure the client to skip starting it by passing the
132132
following option:
133-
133+
134134
.. code-block:: javascript
135135
:emphasize-lines: 2
136-
136+
137137
const extraOptions = {
138-
mongocryptdBypassSpawn: true;
138+
mongocryptdBypassSpawn: true,
139139
}
140140
---
141141
title: Create the MongoClient
@@ -146,13 +146,13 @@ content: |
146146
settings:
147147
148148
.. tabs-drivers::
149-
149+
150150
.. tab::
151151
:tabid: java-sync
152-
152+
153153
.. code-block:: java
154154
:emphasize-lines: 3-8
155-
155+
156156
MongoClientSettings clientSettings = MongoClientSettings.builder()
157157
.applyConnectionString(new ConnectionString("mongodb://localhost:27017"))
158158
.autoEncryptionSettings(AutoEncryptionSettings.builder()
@@ -162,22 +162,23 @@ content: |
162162
.extraOptions(extraOptions)
163163
.build())
164164
.build();
165-
165+
166166
MongoClient mongoClient = MongoClients.create(clientSettings);
167167
.. tab::
168168
:tabid: nodejs
169-
169+
170170
.. code-block:: javascript
171-
171+
:emphasize-lines: 5-9
172+
172173
const secureClient = new MongoClient(connectionString, {
173174
useNewUrlParser: true,
174175
useUnifiedTopology: true,
175176
monitorCommands: true,
176-
autoEncryption: {
177-
keyVaultNamespace,
178-
kmsProviders,
177+
autoEncryption: {
178+
keyVaultNamespace,
179+
kmsProviders,
179180
schemaMap: patientSchema,
180-
extraOptions: extraOptions
181+
extraOptions: extraOptions,
181182
}
182183
});
183184
...

0 commit comments

Comments
 (0)