Skip to content
Merged
Changes from 1 commit
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
10 changes: 6 additions & 4 deletions docs/field-level-encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ 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 { ClientEncryption } = require('mongodb-client-encryption'); As of version 6, ClientEncryption is moved to main mongodb driver.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this commented out code, but otherwise LGTM

const mongoose = require('mongoose');
const { Binary } = require('mongodb');

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

Expand All @@ -66,12 +66,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