Skip to content

Commit

Permalink
fix(mongo-client): options should not be passed to connect
Browse files Browse the repository at this point in the history
Passing `options` to the `connect` object for parsed topologies
in `createServer` effectively overrides the options that were
originally passed into the client.

NODE-1132
  • Loading branch information
mbroadst committed Sep 9, 2017
1 parent 9fb3d86 commit 474ac65
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/mongo_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ var validOptionNames = [
'user',
'password',
'authMechanism',
'compression'
'compression',
'fsync',
'readPreferenceTags',
'numberOfRetries',
'autoReconnect',
'auto_reconnect'
];

var ignoreOptionNames = ['native_parser'];
Expand Down Expand Up @@ -610,13 +615,11 @@ function createServer(self, options, callback) {
// Set default options
var servers = translateOptions(options);

console.log(servers[0].s.clonedOptions);
console.log(servers[0].s.options);

// Propegate the events to the client
var collectedEvents = collectEvents(self, servers[0]);

// Connect to topology
servers[0].connect(options, function(err, topology) {
servers[0].connect(function(err, topology) {
if (err) return callback(err);
// Clear out all the collected event listeners
clearAllEvents(servers[0]);
Expand Down

0 comments on commit 474ac65

Please sign in to comment.