Navigation Menu

Skip to content

Commit

Permalink
useNewUrlParser: true by default
Browse files Browse the repository at this point in the history
  • Loading branch information
yurijmikhalevich committed Mar 13, 2019
1 parent dc42ae4 commit 15cf30b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -38,7 +38,7 @@ false.
* __db:__ MongoDB connection uri, pre-connected `MongoClient` object or promise
which resolves to a pre-connected `MongoClient` object.
* __options:__ MongoDB connection parameters (optional, defaults to
`{poolSize: 2, autoReconnect: true}`).
`{poolSize: 2, autoReconnect: true, useNewUrlParser: true}`).
* __collection__: The name of the collection you want to store log messages in,
defaults to 'log'.
* __storeHost:__ Boolean indicating if you want to store machine hostname in
Expand Down
5 changes: 3 additions & 2 deletions lib/winston-mongodb.js
Expand Up @@ -26,7 +26,7 @@ const helpers = require('./helpers');
* @param {string|Object} options.db MongoDB connection uri or preconnected db
* object.
* @param {Object} options.options MongoDB connection parameters
* (optional, defaults to `{poolSize: 2, autoReconnect: true}`).
* (optional, defaults to `{poolSize: 2, autoReconnect: true, useNewUrlParser: true}`).
* @param {string=logs} options.collection The name of the collection you want
* to store log messages in.
* @param {boolean=false} options.storeHost Boolean indicating if you want to
Expand Down Expand Up @@ -63,7 +63,8 @@ let MongoDB = exports.MongoDB = function(options) {
if (!this.options) {
this.options = {
poolSize: 2,
autoReconnect: true
autoReconnect: true,
useNewUrlParser: true
};
}
this.collection = (options.collection || 'log');
Expand Down
2 changes: 1 addition & 1 deletion test/winston-mongodb-test.js
Expand Up @@ -15,7 +15,7 @@ const MongoDB = require('../lib/winston-mongodb').MongoDB;
const dbUrl = process.env.USER_WINSTON_MONGODB_URL
||process.env.WINSTON_MONGODB_URL||'mongodb://localhost:27017/winston';

mongoose.connect(dbUrl);
mongoose.connect(dbUrl, {useNewUrlParser: true});

describe('winston-mongodb-manual-tests', function() {
describe('winston-mongodb', function() {
Expand Down

0 comments on commit 15cf30b

Please sign in to comment.