diff --git a/services/web/app/src/infrastructure/Mongoose.js b/services/web/app/src/infrastructure/Mongoose.js index 7dc3f0c310..e91521ef29 100644 --- a/services/web/app/src/infrastructure/Mongoose.js +++ b/services/web/app/src/infrastructure/Mongoose.js @@ -13,7 +13,7 @@ if ( ) } -mongoose.connect( +const connectionPromise = mongoose.connect( Settings.mongo.url, { poolSize: POOL_SIZE, @@ -54,4 +54,11 @@ mongoose.plugin(schema => { mongoose.Promise = global.Promise +async function getNativeDb() { + const connection = await connectionPromise + return connection.db +} + +mongoose.getNativeDb = getNativeDb + module.exports = mongoose