Skip to content

Commit 64b27bc

Browse files
authored
Merge pull request #15272 from dphrag/patch-1
Update field-level-encryption.md
2 parents 8c7e32d + 9a0f124 commit 64b27bc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/field-level-encryption.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ Keep in mind that the following example is a simple example to help you get star
3939
The encryption key in the following example is insecure; MongoDB recommends using a [KMS](https://www.mongodb.com/docs/v5.0/core/security-client-side-encryption-key-management/).
4040

4141
```javascript
42-
const { ClientEncryption } = require('mongodb-client-encryption');
42+
const { ClientEncryption } = require('mongodb');
4343
const mongoose = require('mongoose');
44-
const { Binary } = require('mongodb');
4544

4645
run().catch(err => console.log(err));
4746

@@ -66,12 +65,14 @@ async function run() {
6665
kmsProviders
6766
}
6867
}).asPromise();
69-
const encryption = new ClientEncryption(conn.client, {
68+
const encryption = new ClientEncryption(conn.getClient(), {
7069
keyVaultNamespace,
7170
kmsProviders,
7271
});
7372

74-
const _key = await encryption.createDataKey('local');
73+
const _key = await encryption.createDataKey('local', {
74+
keyAltNames: ['exampleKeyName'],
75+
});
7576
}
7677
```
7778

0 commit comments

Comments
 (0)