Skip to content

Commit

Permalink
#2833 Fix Mongo Deprecation Warnings - Update Connect Options
Browse files Browse the repository at this point in the history
  • Loading branch information
Huy Hoang TRINH committed Apr 23, 2020
1 parent c57197f commit 7ba415d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions backend/core/db/mongo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ function getDefaultOptions() {
w: 1,
fsync: true,
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
useFindAndModify: false,
keepAlive: timeout,
connectTimeoutMS: timeout,
auto_reconnect: true,
Expand Down
4 changes: 4 additions & 0 deletions fixtures/config/data/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module.exports = function(dbHost = 'localhost', dbPort = 27017, dbName = 'esn',
connectionOptions: {
w: 1,
fsync: true,
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
useFindAndModify: false,
keepAlive: 10000,
connectTimeoutMS: 10000,
auto_reconnect: true,
Expand Down
8 changes: 7 additions & 1 deletion test/midway-backend/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ before(function() {
writeDBConfigFile: function() {
fs.writeFileSync(`${tmpPath}/db.json`, JSON.stringify({
connectionString: `mongodb://${testConfig.mongodb.host}:${testConfig.mongodb.port}/${testConfig.mongodb.dbname}`,
connectionOptions: { auto_reconnect: false }
connectionOptions: {
useNewUrlParser: true,
useUnifiedTopology: true,
useCreateIndex: true,
useFindAndModify: false,
auto_reconnect: false
}
}));
},

Expand Down

0 comments on commit 7ba415d

Please sign in to comment.