Skip to content

Commit fbf61d1

Browse files
author
Chris Cho
authored
DOCSP-10121: CSFLE guide fixes (#636)
1 parent dc773a1 commit fbf61d1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ ref: create-a-data-encryption-key
103103
level: 4
104104
content: |
105105
Construct a client with the MongoDB connection string and key vault
106-
namespace configuration, and create a data encryption key with the
107-
following **code snippet**. The key vault in
108-
this example uses the ``encryption`` database and ``__keyVault`` collection.
106+
namespace configuration, create a unique index on the ``keyAltNames`` field
107+
in that collection, and create a data encryption key with the following
108+
**code snippet**. The key vault in this example uses the ``encryption``
109+
database and ``__keyVault`` collection.
109110
110111
.. tabs-drivers::
111112
@@ -298,7 +299,10 @@ content: |
298299
:tabid: nodejs
299300
300301
.. code-block:: javascript
301-
:emphasize-lines: 4
302+
:emphasize-lines: 7
303+
304+
const mongodb = require("mongodb")
305+
const { MongoClient, Binary } = mongodb
302306
303307
const connectionString = 'mongodb://localhost:27017/';
304308
const keyVaultDb = 'encryption';
@@ -316,7 +320,7 @@ content: |
316320
const keyDB = client.db(keyVaultDb);
317321
const keyColl = keyDB.collection(keyVaultCollection);
318322
const query = {
319-
_id: base64KeyId,
323+
_id: new Binary(Buffer.from(base64KeyId, "base64"), 4),
320324
};
321325
const dataKey = await keyColl.findOne(query);
322326
console.log(dataKey);

source/use-cases/client-side-field-level-encryption-guide.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ data encryption key:
375375

376376
- The key vault namespace (database and collection).
377377

378+
- A unique index for the key vault collection on the ``keyAltNames`` field
379+
378380
Follow the steps below to generate a single data encryption key from the
379381
locally-managed master key.
380382

0 commit comments

Comments
 (0)