npm Mongoose-encryption code example
Example 1: mongoose encryption npm
npm i mongoose-encryption
Example 2: mongoose-encryption
// encrypt age regardless of any other options. name and _id will be left unencrypted
userSchema.plugin(encrypt, { encryptionKey: encKey, signingKey: sigKey, encryptedFields: ['age'] });