From ac8fa03ba79fb6135bb04cc20683c23570fa1602 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Wed, 8 Mar 2017 12:36:10 -0500 Subject: [PATCH] Fix deprecation warnings due to legacy mongoOptions. Warning text: "the server/replset/mongos options are deprecated, all their options are supported at the top level of the options object" --- packages/mongo/mongo_driver.js | 22 ++++++++-------------- packages/mongo/package.js | 4 ++-- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/packages/mongo/mongo_driver.js b/packages/mongo/mongo_driver.js index 348f01378a..05db52fd8b 100644 --- a/packages/mongo/mongo_driver.js +++ b/packages/mongo/mongo_driver.js @@ -128,17 +128,12 @@ MongoConnection = function (url, options) { self._observeMultiplexers = {}; self._onFailoverHook = new Hook; - var mongoOptions = _.extend({ - db: { safe: true }, - // http://mongodb.github.io/node-mongodb-native/2.2/api/Server.html - server: { - // Reconnect on error. - autoReconnect: true, - // Try to reconnect forever, instead of stopping after 30 tries (the - // default), with each attempt separated by 1000ms. - reconnectTries: Infinity - }, - replSet: {} + var mongoOptions = Object.assign({ + // Reconnect on error. + autoReconnect: true, + // Try to reconnect forever, instead of stopping after 30 tries (the + // default), with each attempt separated by 1000ms. + reconnectTries: Infinity }, Mongo._connectionOptions); // Disable the native parser by default, unless specifically enabled @@ -150,7 +145,7 @@ MongoConnection = function (url, options) { // to a different platform (aka deploy) // We should revisit this after binary npm module support lands. if (!(/[\?&]native_?[pP]arser=/.test(url))) { - mongoOptions.db.native_parser = false; + mongoOptions.native_parser = false; } // Internally the oplog connections specify their own poolSize @@ -158,8 +153,7 @@ MongoConnection = function (url, options) { if (_.has(options, 'poolSize')) { // If we just set this for "server", replSet will override it. If we just // set it for replSet, it will be ignored if we're not using a replSet. - mongoOptions.server.poolSize = options.poolSize; - mongoOptions.replSet.poolSize = options.poolSize; + mongoOptions.poolSize = options.poolSize; } self.db = null; diff --git a/packages/mongo/package.js b/packages/mongo/package.js index 65168569da..f268d568cc 100644 --- a/packages/mongo/package.js +++ b/packages/mongo/package.js @@ -9,7 +9,7 @@ Package.describe({ summary: "Adaptor for using MongoDB and Minimongo over DDP", - version: '1.1.15' + version: '1.1.16' }); Npm.depends({ @@ -21,7 +21,7 @@ Npm.strip({ }); Package.onUse(function (api) { - api.use('npm-mongo', 'server'); + api.use('npm-mongo@2.2.24', 'server'); api.use('allow-deny'); api.use([