mongodb 2.2.29 → 2.2.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/url_parser.js CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  var ReadPreference = require('./read_preference'),
4
4
  parser = require('url'),
5
- f = require('util').format;
5
+ f = require('util').format,
6
+ assign = require('./utils').assign;
6
7
 
7
- module.exports = function(url) {
8
+ module.exports = function(url, options) {
8
9
  // Variables
9
10
  var connection_part = '';
10
11
  var auth_part = '';
@@ -144,6 +145,8 @@ module.exports = function(url) {
144
145
 
145
146
  // Add auth to final object if we have 2 elements
146
147
  if(auth.length == 2) object.auth = {user: auth[0], password: auth[1]};
148
+ // if user provided auth options, use that
149
+ if(options && options.auth != null) object.auth = options.auth;
147
150
 
148
151
  // Variables used for temporary storage
149
152
  var hostPart;
@@ -190,7 +193,7 @@ module.exports = function(url) {
190
193
  if(_host.indexOf("?") != -1) _host = _host.split(/\?/)[0];
191
194
  }
192
195
 
193
- // No entry returned for duplicate servr
196
+ // No entry returned for duplicate server
194
197
  if(deduplicatedServers[_host + "_" + _port]) return null;
195
198
  deduplicatedServers[_host + "_" + _port] = 1;
196
199
 
@@ -398,8 +401,12 @@ module.exports = function(url) {
398
401
  dbOptions.readPreference = 'primary';
399
402
  }
400
403
 
404
+ // make sure that user-provided options are applied with priority
405
+ dbOptions = assign(dbOptions, options);
406
+
401
407
  // Add servers to result
402
408
  object.servers = servers;
409
+
403
410
  // Returned parsed object
404
411
  return object;
405
412
  }
package/lib/utils.js CHANGED
@@ -107,7 +107,7 @@ var checkCollectionName = function checkCollectionName (collectionName) {
107
107
  throw new MongoError("collection names must not start or end with '.'");
108
108
  }
109
109
 
110
- // Validate that we are not passing 0x00 in the colletion name
110
+ // Validate that we are not passing 0x00 in the collection name
111
111
  if(!!~collectionName.indexOf("\x00")) {
112
112
  throw new MongoError("collection names cannot contain a null character");
113
113
  }
@@ -295,7 +295,7 @@ var filterOptions = function(options, names) {
295
295
  return filterOptions;
296
296
  }
297
297
 
298
- // Object.assign method or polyfille
298
+ // Object.assign method or polyfill
299
299
  var assign = Object.assign ? Object.assign : function assign(target) {
300
300
  if (target === undefined || target === null) {
301
301
  throw new TypeError('Cannot convert first argument to object');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb",
3
- "version": "2.2.29",
3
+ "version": "2.2.33",
4
4
  "description": "The official MongoDB driver for Node.js",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "dependencies": {
16
16
  "es6-promise": "3.2.1",
17
- "mongodb-core": "2.1.13",
17
+ "mongodb-core": "2.1.17",
18
18
  "readable-stream": "2.2.7"
19
19
  },
20
20
  "devDependencies": {
@@ -50,7 +50,7 @@
50
50
  "url": "https://github.com/mongodb/node-mongodb-native/issues"
51
51
  },
52
52
  "scripts": {
53
- "test": "node test/runner.js -t functional -l",
53
+ "test": "node test/runner.js -t functional",
54
54
  "coverage": "node_modules/.bin/nyc node test/runner.js -t functional && node_modules/.bin/nyc report --reporter=text-lcov | node_modules/.bin/coveralls",
55
55
  "lint": "eslint lib"
56
56
  },