mongodb 3.0.7 → 3.0.8

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/HISTORY.md CHANGED
@@ -1,3 +1,14 @@
1
+ <a name="3.0.8"></a>
2
+ ## [3.0.8](https://github.com/mongodb/node-mongodb-native/compare/v3.0.7...v3.0.8) (2018-05-08)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **aggregte:** support user-provided `batchSize` ([0a5b5e8](https://github.com/mongodb/node-mongodb-native/commit/0a5b5e8))
8
+ * **mongo-client:** pass arguments to ctor when new keyword is used ([8165f7a](https://github.com/mongodb/node-mongodb-native/commit/8165f7a))
9
+
10
+
11
+
1
12
  <a name="3.0.7"></a>
2
13
  ## [3.0.7](https://github.com/mongodb/node-mongodb-native/compare/v3.0.6...v3.0.7) (2018-04-17)
3
14
 
package/lib/collection.js CHANGED
@@ -2430,7 +2430,8 @@ Collection.prototype.aggregate = function(pipeline, options, callback) {
2430
2430
  throw toError('cursor options must be an object');
2431
2431
  }
2432
2432
 
2433
- options.cursor = options.cursor || { batchSize: 1000 };
2433
+ options.cursor = options.cursor || {};
2434
+ if (options.batchSize) options.cursor.batchSize = options.batchSize;
2434
2435
  command.cursor = options.cursor;
2435
2436
 
2436
2437
  // promiseLibrary
package/lib/db.js CHANGED
@@ -573,7 +573,7 @@ var createCollection = function(self, name, options, callback) {
573
573
  * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object.
574
574
  * @param {boolean} [options.strict=false] Returns an error if the collection does not exist
575
575
  * @param {boolean} [options.capped=false] Create a capped collection.
576
- * @param {boolean} [options.autoIndexId=true] Create an index on the _id field of the document, True by default on MongoDB 2.2 or higher off for version < 2.2.
576
+ * @param {boolean} [options.autoIndexId=true] DEPRECATED: Create an index on the _id field of the document, True by default on MongoDB 2.6 - 3.0
577
577
  * @param {number} [options.size=null] The size of the capped collection in bytes.
578
578
  * @param {number} [options.max=null] The maximum number of documents in the capped collection.
579
579
  * @param {number} [options.flags=null] Optional. Available for the MMAPv1 storage engine only to set the usePowerOf2Sizes and the noPadding flag.
@@ -594,6 +594,10 @@ Db.prototype.createCollection = function(name, options, callback) {
594
594
  options = options || {};
595
595
  options.promiseLibrary = options.promiseLibrary || this.s.promiseLibrary;
596
596
 
597
+ if (options.autoIndexId !== undefined) {
598
+ console.warn('the autoIndexId option is deprecated and will be removed in a future release');
599
+ }
600
+
597
601
  return executeOperation(this.s.topology, createCollection, [this, name, options, callback]);
598
602
  };
599
603
 
@@ -1035,11 +1039,18 @@ var createIndex = function(self, name, fieldOrSpec, options, callback) {
1035
1039
 
1036
1040
  // 67 = 'CannotCreateIndex' (malformed index options)
1037
1041
  // 85 = 'IndexOptionsConflict' (index already exists with different options)
1042
+ // 86 = 'IndexKeySpecsConflict' (index already exists with the same name)
1038
1043
  // 11000 = 'DuplicateKey' (couldn't build unique index because of dupes)
1039
1044
  // 11600 = 'InterruptedAtShutdown' (interrupted at shutdown)
1040
1045
  // These errors mean that the server recognized `createIndex` as a command
1041
1046
  // and so we don't need to fallback to an insert.
1042
- if (err.code === 67 || err.code === 11000 || err.code === 85 || err.code === 11600) {
1047
+ if (
1048
+ err.code === 67 ||
1049
+ err.code === 11000 ||
1050
+ err.code === 85 ||
1051
+ err.code === 86 ||
1052
+ err.code === 11600
1053
+ ) {
1043
1054
  return handleCallback(callback, err, result);
1044
1055
  }
1045
1056
 
@@ -200,11 +200,12 @@ function validOptions(options) {
200
200
  * @param {number} [options.numberOfRetries=5] The number of retries for a tailable cursor
201
201
  * @param {boolean} [options.auto_reconnect=true] Enable auto reconnecting for single server instances
202
202
  * @param {boolean} [options.monitorCommands=false] Enable command monitoring for this client
203
+ * @param {number} [options.minSize] If present, the connection pool will be initialized with minSize connections, and will never dip below minSize connections
203
204
  * @param {MongoClient~connectCallback} [callback] The command result callback
204
205
  * @return {MongoClient} a MongoClient instance
205
206
  */
206
207
  function MongoClient(url, options) {
207
- if (!(this instanceof MongoClient)) return new MongoClient();
208
+ if (!(this instanceof MongoClient)) return new MongoClient(url, options);
208
209
 
209
210
  // Set up event emitter
210
211
  EventEmitter.call(this);
@@ -465,6 +466,7 @@ MongoClient.prototype.isConnected = function(options) {
465
466
  * @param {array} [options.readPreferenceTags=null] Read preference tags
466
467
  * @param {number} [options.numberOfRetries=5] The number of retries for a tailable cursor
467
468
  * @param {boolean} [options.auto_reconnect=true] Enable auto reconnecting for single server instances
469
+ * @param {number} [options.minSize] If present, the connection pool will be initialized with minSize connections, and will never dip below minSize connections
468
470
  * @param {MongoClient~connectCallback} [callback] The command result callback
469
471
  * @return {Promise<MongoClient>} returns Promise if no callback passed
470
472
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "description": "The official MongoDB driver for Node.js",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -13,7 +13,7 @@
13
13
  "official"
14
14
  ],
15
15
  "dependencies": {
16
- "mongodb-core": "3.0.7"
16
+ "mongodb-core": "3.0.8"
17
17
  },
18
18
  "devDependencies": {
19
19
  "bluebird": "3.5.0",