diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 398239535b..e19b646ba8 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -37,6 +37,7 @@ // Dongjun Lee // Valentin Agachi // Jan Nemcik +// Cl3dson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -395,6 +396,15 @@ declare module "mongoose" { * is set to true.(default: false) */ autoCreate?: boolean; + + /** Configure csfle as especified in MongoDB official guide */ + autoEncryption?: { + keyVaultNamespace: string, + kmsProviders: any, + schemaMap: any, + extraOptions?: any + } + /** Specify a journal write concern (default: false). */ journal?: boolean; diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index ef99393420..548d63e930 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -37,6 +37,22 @@ const connection3 = mongoose.connect(connectUri, function (error) { error.stack; }); +/** + * Test taken from MongoDB CSFLE guide + * https://docs.mongodb.com/drivers/use-cases/client-side-field-level-encryption-guide + */ + +const connection4:Promise = mongoose.connect(connectUri,{ + useNewUrlParser: true, + useUnifiedTopology: true, + autoEncryption: { + keyVaultNamespace: 'encryption.__keyVault', + kmsProviders: {}, + schemaMap: {}, + extraOptions: {} + } +}) + var mongooseConnection: mongoose.Connection = mongoose.createConnection(); mongooseConnection.dropDatabase().then(()=>{}); mongooseConnection.dropCollection('foo').then(()=>{});