diff --git a/lib/topologies/mongos.js b/lib/topologies/mongos.js index 52d08f101b..a1847e2c17 100644 --- a/lib/topologies/mongos.js +++ b/lib/topologies/mongos.js @@ -209,7 +209,7 @@ class Mongos extends TopologyBase { } // Connect - connect(db, _options, callback) { + connect(_options, callback) { var self = this; if ('function' === typeof _options) (callback = _options), (_options = {}); if (_options == null) _options = {}; @@ -218,7 +218,8 @@ class Mongos extends TopologyBase { self.s.options = _options; // Update bufferMaxEntries - self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries; + self.s.storeOptions.bufferMaxEntries = + typeof _options.bufferMaxEntries === 'number' ? _options.bufferMaxEntries : -1; // Error handler var connectErrorHandler = function() { diff --git a/lib/topologies/replset.js b/lib/topologies/replset.js index ee584b7276..e04260c0a8 100644 --- a/lib/topologies/replset.js +++ b/lib/topologies/replset.js @@ -236,7 +236,7 @@ class ReplSet extends TopologyBase { } // Connect method - connect(db, _options, callback) { + connect(_options, callback) { var self = this; if ('function' === typeof _options) (callback = _options), (_options = {}); if (_options == null) _options = {}; @@ -245,7 +245,8 @@ class ReplSet extends TopologyBase { self.s.options = _options; // Update bufferMaxEntries - self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries; + self.s.storeOptions.bufferMaxEntries = + typeof _options.bufferMaxEntries === 'number' ? _options.bufferMaxEntries : -1; // Actual handler var errorHandler = function(event) {