Skip to content

Commit

Permalink
fix(topologies): unify topologies connect API
Browse files Browse the repository at this point in the history
Eliminates the DB parameter from the `connect` call in replset
and mongos to unify the api with server
  • Loading branch information
daprahamian committed Dec 12, 2017
1 parent f608f44 commit 2edfdd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/topologies/mongos.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand All @@ -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() {
Expand Down
5 changes: 3 additions & 2 deletions lib/topologies/replset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand All @@ -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) {
Expand Down

0 comments on commit 2edfdd8

Please sign in to comment.