Skip to content

Commit ebe703a

Browse files
add docs about registering models
1 parent 6f202f5 commit ebe703a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/field-level-encryption.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,13 @@ To declare a field as encrypted, you must:
150150
2. Choose an encryption type for the schema and configure the schema for the encryption type
151151

152152
Not all schematypes are supported for CSFLE and QE. For an overview of valid schema types, refer to MongoDB's documentation.
153+
154+
### Registering Models
155+
156+
Encrypted schemas must be registered on a connection, not the Mongoose global:
157+
158+
```javascript
159+
160+
const connection = mongoose.createConnection();
161+
const UserModel = connection.model('User', encryptedUserSchema);
162+
```

0 commit comments

Comments
 (0)