mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
[mongoose] Added connection options related to auto encryption using CSFLE (#43723)
* added new connection options related to the new feature csfle * added basic test case for auto-encryption in mongoose client connection
This commit is contained in:
Vendored
+10
@@ -37,6 +37,7 @@
|
||||
// Dongjun Lee <https://github.com/ChazEpps>
|
||||
// Valentin Agachi <https://github.com/avaly>
|
||||
// Jan Nemcik <https://github.com/JanNemcik>
|
||||
// Cl3dson <https://github.com/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;
|
||||
|
||||
|
||||
@@ -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.Mongoose> = 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(()=>{});
|
||||
|
||||
Reference in New Issue
Block a user