diff --git a/services/contacts/app/js/mongodb.js b/services/contacts/app/js/mongodb.js index a0e5cc9f66..81aa289428 100644 --- a/services/contacts/app/js/mongodb.js +++ b/services/contacts/app/js/mongodb.js @@ -1,7 +1,10 @@ const Settings = require('settings-sharelatex') const { MongoClient, ObjectId } = require('mongodb') -const clientPromise = MongoClient.connect(Settings.mongo.url) +const clientPromise = MongoClient.connect( + Settings.mongo.url, + Settings.mongo.options +) let setupDbPromise async function waitForDb() { diff --git a/services/contacts/config/settings.defaults.js b/services/contacts/config/settings.defaults.js index 996670f02c..fa6b97b6d6 100644 --- a/services/contacts/config/settings.defaults.js +++ b/services/contacts/config/settings.defaults.js @@ -10,6 +10,10 @@ module.exports = { }, mongo: { + options: { + useUnifiedTopology: + (process.env.MONGO_USE_UNIFIED_TOPOLOGY || 'true') === 'true' + }, url: process.env.MONGO_CONNECTION_STRING || `mongodb://${process.env.MONGO_HOST || 'localhost'}/sharelatex`