Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/field-level-encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ Keep in mind that the following example is a simple example to help you get star
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/).

```javascript
const { ClientEncryption } = require('mongodb-client-encryption');
const { ClientEncryption } = require('mongodb');
const mongoose = require('mongoose');
const { Binary } = require('mongodb');

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

Expand All @@ -66,12 +65,14 @@ async function run() {
kmsProviders
}
}).asPromise();
const encryption = new ClientEncryption(conn.client, {
const encryption = new ClientEncryption(conn.getClient(), {
keyVaultNamespace,
kmsProviders,
});

const _key = await encryption.createDataKey('local');
const _key = await encryption.createDataKey('local', {
keyAltNames: ['exampleKeyName'],
});
}
```

Expand Down
Loading