diff --git a/services/chat/app/js/mongodb.js b/services/chat/app/js/mongodb.js index 11458226e1..ff788f8f96 100644 --- a/services/chat/app/js/mongodb.js +++ b/services/chat/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/chat/config/settings.defaults.js b/services/chat/config/settings.defaults.js index 42f24ef5cc..8784445adf 100644 --- a/services/chat/config/settings.defaults.js +++ b/services/chat/config/settings.defaults.js @@ -17,6 +17,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`