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