From 474ac65ce83abe74487c042d049670bbeb16b316 Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Sat, 9 Sep 2017 11:08:59 -0400 Subject: [PATCH] fix(mongo-client): options should not be passed to `connect` Passing `options` to the `connect` object for parsed topologies in `createServer` effectively overrides the options that were originally passed into the client. NODE-1132 --- lib/mongo_client.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/mongo_client.js b/lib/mongo_client.js index 1133f16669..cd8f4583b0 100644 --- a/lib/mongo_client.js +++ b/lib/mongo_client.js @@ -82,7 +82,12 @@ var validOptionNames = [ 'user', 'password', 'authMechanism', - 'compression' + 'compression', + 'fsync', + 'readPreferenceTags', + 'numberOfRetries', + 'autoReconnect', + 'auto_reconnect' ]; var ignoreOptionNames = ['native_parser']; @@ -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]);