From baaf3761283d501e5b3486f9e46ff3b13afee3c3 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 10 Sep 2020 10:57:29 +0100 Subject: [PATCH] [misc] mongodb: use the new db connector by default mongojs was enabling it by default as well. --- services/spelling/app/js/mongodb.js | 5 ++++- services/spelling/config/settings.defaults.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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`