connect-mongodb icon indicating copy to clipboard operation
connect-mongodb copied to clipboard

New Mongo driver demands 'default write concern'

Open itpmngt opened this issue 12 years ago • 1 comments

When we start Node using connect-mongodb brings a Warning message: ' Please ensure that you set the default write concern for the database by setting....'

I've done a patch to add w:0 as the default 'write concern' allowing to change options

DIFF --- connect-mongodb-original.js 2013-01-25 13:09:30.000000000 +0000 +++ connect-mongodb.js 2013-01-25 14:59:08.000000000 +0000 @@ -8,7 +8,7 @@ var Store = require('connect').session.Store , mongo = require('mongodb') , _collection = null

  • , _defaults = {host: '127.0.0.1', port: 27017, dbname: 'dev', collection: 'sessions', reapInterval: 60 * 1000};
  • , _defaults = {host: '127.0.0.1', port: 27017, dbname: 'dev', collection: 'sessions', reapInterval: 60 * 1000, w: 0};

function _default(callback) { callback = typeof(callback) === 'function' ? callback : function () { }; @@ -57,7 +57,8 @@

options.db = new mongo.Db( url.pathname.replace(/^//, '')

  • , new mongo.Server(url.hostname || _defaults.host, +url.port || _defaults.port, {w: 1})
  • , new mongo.Server(url.hostname || _defaults.host, +url.port || _defaults.port)
  • , { w: options.w || _defaults.w} ); }

itpmngt avatar Feb 05 '13 09:02 itpmngt

Thanks a lot!

vitalets avatar Feb 11 '13 11:02 vitalets