Commit 6708977d authored by anton's avatar anton
Browse files

Add useUnifiedTopology option

parent aa752f59
......@@ -3,8 +3,10 @@ const MongoClient = require('mongodb').MongoClient
module.exports = function (app) {
const connection = app.get('mongodb')
const database = connection.substr(connection.lastIndexOf('/') + 1)
const mongoClient = MongoClient.connect(connection, { useNewUrlParser: true })
.then(client => client.db(database))
const mongoClient = MongoClient.connect(connection, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(client => client.db(database))
app.set('mongoClient', mongoClient)
}
......@@ -4,7 +4,11 @@ const logger = require('./logger')
module.exports = function (app) {
mongoose.connect(
app.get('mongodb'),
{ useCreateIndex: true, useNewUrlParser: true }
{
useCreateIndex: true,
useNewUrlParser: true,
useUnifiedTopology: true
}
).catch(err => {
logger.error(err)
process.exit(1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment