diff --git a/services/spelling/app/js/mongodb.js b/services/spelling/app/js/mongodb.js index 6728bd0f5a..8016bbc1f8 100644 --- a/services/spelling/app/js/mongodb.js +++ b/services/spelling/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/spelling/config/settings.defaults.js b/services/spelling/config/settings.defaults.js index 03e22c010c..702f39ec73 100644 --- a/services/spelling/config/settings.defaults.js +++ b/services/spelling/config/settings.defaults.js @@ -9,6 +9,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`