Skip to content

Commit

Permalink
add docs about registering models
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Jan 17, 2025
1 parent 6f202f5 commit ebe703a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/field-level-encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,13 @@ To declare a field as encrypted, you must:
2. Choose an encryption type for the schema and configure the schema for the encryption type

Not all schematypes are supported for CSFLE and QE. For an overview of valid schema types, refer to MongoDB's documentation.

### Registering Models

Encrypted schemas must be registered on a connection, not the Mongoose global:

```javascript

const connection = mongoose.createConnection();
const UserModel = connection.model('User', encryptedUserSchema);
```

0 comments on commit ebe703a

Please sign in to comment.