mongodb 3.2.2 → 3.2.3
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 +18 -0
- package/lib/aggregation_cursor.js +3 -3
- package/lib/async/async_iterator.js +27 -9
- package/lib/bulk/common.js +16 -11
- package/lib/bulk/ordered.js +1 -1
- package/lib/bulk/unordered.js +1 -1
- package/lib/collection.js +15 -15
- package/lib/command_cursor.js +2 -2
- package/lib/cursor.js +3 -3
- package/lib/db.js +4 -4
- package/lib/gridfs/grid_store.js +1 -1
- package/lib/mongo_client.js +10 -4
- package/lib/operations/collection_ops.js +1 -1
- package/lib/operations/db_ops.js +1 -1
- package/lib/operations/mongo_client_ops.js +1 -1
- package/lib/topologies/mongos.js +1 -1
- package/lib/topologies/replset.js +1 -1
- package/lib/topologies/server.js +1 -1
- package/lib/url_parser.js +1 -1
- package/lib/utils.js +1 -1
- package/package.json +2 -2
package/HISTORY.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
<a name="3.2.3"></a>
|
|
6
|
+
## [3.2.3](https://github.com/mongodb/node-mongodb-native/compare/v3.2.2...v3.2.3) (2019-04-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **aggregation:** fix field name typo ([4235d04](https://github.com/mongodb/node-mongodb-native/commit/4235d04))
|
|
12
|
+
* **async:** rewrote asyncGenerator in node < 10 syntax ([49c8cef](https://github.com/mongodb/node-mongodb-native/commit/49c8cef))
|
|
13
|
+
* **bulkWrite:** fix issue with bulkWrite continuing w/ callback ([2a4a42c](https://github.com/mongodb/node-mongodb-native/commit/2a4a42c))
|
|
14
|
+
* **docs:** correctly document that default for `sslValidate` is false ([1f8e7fa](https://github.com/mongodb/node-mongodb-native/commit/1f8e7fa))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* update to mongodb-core v3.2.3 ([1c5357a](https://github.com/mongodb/node-mongodb-native/commit/1c5357a))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
5
23
|
<a name="3.2.2"></a>
|
|
6
24
|
## [3.2.2](https://github.com/mongodb/node-mongodb-native/compare/v3.2.1...v3.2.2) (2019-03-22)
|
|
7
25
|
|
|
@@ -148,7 +148,7 @@ AggregationCursor.prototype.batchSize = function(value) {
|
|
|
148
148
|
if (this.s.state === AggregationCursor.CLOSED || this.isDead())
|
|
149
149
|
throw MongoError.create({ message: 'Cursor is closed', driver: true });
|
|
150
150
|
if (typeof value !== 'number')
|
|
151
|
-
throw MongoError.create({ message: 'batchSize requires an integer',
|
|
151
|
+
throw MongoError.create({ message: 'batchSize requires an integer', driver: true });
|
|
152
152
|
if (this.s.cmd.cursor) this.s.cmd.cursor.batchSize = value;
|
|
153
153
|
this.setCursorBatchSize(value);
|
|
154
154
|
return this;
|
|
@@ -326,7 +326,7 @@ AggregationCursor.prototype.get = AggregationCursor.prototype.toArray;
|
|
|
326
326
|
/**
|
|
327
327
|
* Returns an array of documents. The caller is responsible for making sure that there
|
|
328
328
|
* is enough memory to store the results. Note that the array only contain partial
|
|
329
|
-
* results when this cursor had been
|
|
329
|
+
* results when this cursor had been previously accessed. In that case,
|
|
330
330
|
* cursor.rewind() can be used to reset the cursor.
|
|
331
331
|
* @method AggregationCursor.prototype.toArray
|
|
332
332
|
* @param {AggregationCursor~toArrayResultCallback} [callback] The result callback.
|
|
@@ -343,7 +343,7 @@ AggregationCursor.prototype.get = AggregationCursor.prototype.toArray;
|
|
|
343
343
|
|
|
344
344
|
/**
|
|
345
345
|
* Iterates over all the documents for this cursor. As with **{cursor.toArray}**,
|
|
346
|
-
* not all of the elements will be iterated if this cursor had been
|
|
346
|
+
* not all of the elements will be iterated if this cursor had been previously accessed.
|
|
347
347
|
* In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike
|
|
348
348
|
* **{cursor.toArray}**, the cursor will only hold a maximum of batch size elements
|
|
349
349
|
* at any given time if batch size is specified. Otherwise, the caller is responsible
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
async function* asyncIterator() {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
// async function* asyncIterator() {
|
|
4
|
+
// while (true) {
|
|
5
|
+
// const value = await this.next();
|
|
6
|
+
// if (!value) {
|
|
7
|
+
// await this.close();
|
|
8
|
+
// return;
|
|
9
|
+
// }
|
|
10
|
+
|
|
11
|
+
// yield value;
|
|
12
|
+
// }
|
|
13
|
+
// }
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
// TODO: change this to the async generator function above
|
|
16
|
+
function asyncIterator() {
|
|
17
|
+
const cursor = this;
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
next: function() {
|
|
21
|
+
return Promise.resolve()
|
|
22
|
+
.then(() => cursor.next())
|
|
23
|
+
.then(value => {
|
|
24
|
+
if (!value) {
|
|
25
|
+
return cursor.close().then(() => ({ value, done: true }));
|
|
26
|
+
}
|
|
27
|
+
return { value, done: false };
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
13
31
|
}
|
|
14
32
|
|
|
15
33
|
exports.asyncIterator = asyncIterator;
|
package/lib/bulk/common.js
CHANGED
|
@@ -55,7 +55,7 @@ class Batch {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Wraps a legacy operation so we can correctly rewrite
|
|
58
|
+
* Wraps a legacy operation so we can correctly rewrite its error
|
|
59
59
|
* @ignore
|
|
60
60
|
*/
|
|
61
61
|
class LegacyOp {
|
|
@@ -906,6 +906,15 @@ class BulkOperationBase {
|
|
|
906
906
|
);
|
|
907
907
|
}
|
|
908
908
|
|
|
909
|
+
_handleEarlyError(err, callback) {
|
|
910
|
+
if (typeof callback === 'function') {
|
|
911
|
+
callback(err, null);
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
return this.s.promiseLibrary.reject(err);
|
|
916
|
+
}
|
|
917
|
+
|
|
909
918
|
/**
|
|
910
919
|
* Execute next write command in a chain
|
|
911
920
|
*
|
|
@@ -919,19 +928,17 @@ class BulkOperationBase {
|
|
|
919
928
|
if (typeof options === 'function') (callback = options), (options = {});
|
|
920
929
|
options = options || {};
|
|
921
930
|
|
|
922
|
-
if (this.s.executed) {
|
|
923
|
-
const executedError = toError('batch cannot be re-executed');
|
|
924
|
-
return typeof callback === 'function'
|
|
925
|
-
? callback(executedError, null)
|
|
926
|
-
: this.s.promiseLibrary.reject(executedError);
|
|
927
|
-
}
|
|
928
|
-
|
|
929
931
|
if (typeof _writeConcern === 'function') {
|
|
930
932
|
callback = _writeConcern;
|
|
931
933
|
} else if (_writeConcern && typeof _writeConcern === 'object') {
|
|
932
934
|
this.s.writeConcern = _writeConcern;
|
|
933
935
|
}
|
|
934
936
|
|
|
937
|
+
if (this.s.executed) {
|
|
938
|
+
const executedError = toError('batch cannot be re-executed');
|
|
939
|
+
return this._handleEarlyError(executedError, callback);
|
|
940
|
+
}
|
|
941
|
+
|
|
935
942
|
// If we have current batch
|
|
936
943
|
if (this.isOrdered) {
|
|
937
944
|
if (this.s.currentBatch) this.s.batches.push(this.s.currentBatch);
|
|
@@ -943,9 +950,7 @@ class BulkOperationBase {
|
|
|
943
950
|
// If we have no operations in the bulk raise an error
|
|
944
951
|
if (this.s.batches.length === 0) {
|
|
945
952
|
const emptyBatchError = toError('Invalid Operation, no operations specified');
|
|
946
|
-
return
|
|
947
|
-
? callback(emptyBatchError, null)
|
|
948
|
-
: this.s.promiseLibrary.reject(emptyBatchError);
|
|
953
|
+
return this._handleEarlyError(emptyBatchError, callback);
|
|
949
954
|
}
|
|
950
955
|
return { options, callback };
|
|
951
956
|
}
|
package/lib/bulk/ordered.js
CHANGED
|
@@ -119,7 +119,7 @@ class OrderedBulkOperation extends BulkOperationBase {
|
|
|
119
119
|
*/
|
|
120
120
|
execute(_writeConcern, options, callback) {
|
|
121
121
|
const ret = this.bulkExecute(_writeConcern, options, callback);
|
|
122
|
-
if (isPromiseLike(ret)) {
|
|
122
|
+
if (!ret || isPromiseLike(ret)) {
|
|
123
123
|
return ret;
|
|
124
124
|
}
|
|
125
125
|
|
package/lib/bulk/unordered.js
CHANGED
|
@@ -131,7 +131,7 @@ class UnorderedBulkOperation extends BulkOperationBase {
|
|
|
131
131
|
*/
|
|
132
132
|
execute(_writeConcern, options, callback) {
|
|
133
133
|
const ret = this.bulkExecute(_writeConcern, options, callback);
|
|
134
|
-
if (isPromiseLike(ret)) {
|
|
134
|
+
if (!ret || isPromiseLike(ret)) {
|
|
135
135
|
return ret;
|
|
136
136
|
}
|
|
137
137
|
|
package/lib/collection.js
CHANGED
|
@@ -268,7 +268,7 @@ const DEPRECATED_FIND_OPTIONS = ['maxScan', 'fields', 'snapshot'];
|
|
|
268
268
|
* @param {boolean} [options.promoteBuffers=false] Promotes Binary BSON values to native Node Buffers.
|
|
269
269
|
* @param {(ReadPreference|string)} [options.readPreference] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
|
|
270
270
|
* @param {boolean} [options.partial=false] Specify if the cursor should return partial results when querying against a sharded system
|
|
271
|
-
* @param {number} [options.maxTimeMS] Number of
|
|
271
|
+
* @param {number} [options.maxTimeMS] Number of milliseconds to wait before aborting the query.
|
|
272
272
|
* @param {object} [options.collation] Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields).
|
|
273
273
|
* @param {ClientSession} [options.session] optional session to use for this operation
|
|
274
274
|
* @throws {MongoError}
|
|
@@ -454,7 +454,7 @@ Collection.prototype.insertOne = function(doc, options, callback) {
|
|
|
454
454
|
if (typeof options === 'function') (callback = options), (options = {});
|
|
455
455
|
options = options || {};
|
|
456
456
|
|
|
457
|
-
// Add
|
|
457
|
+
// Add ignoreUndefined
|
|
458
458
|
if (this.s.options.ignoreUndefined) {
|
|
459
459
|
options = Object.assign({}, options);
|
|
460
460
|
options.ignoreUndefined = this.s.options.ignoreUndefined;
|
|
@@ -685,7 +685,7 @@ Collection.prototype.updateOne = function(filter, update, options, callback) {
|
|
|
685
685
|
|
|
686
686
|
options = Object.assign({}, options);
|
|
687
687
|
|
|
688
|
-
// Add
|
|
688
|
+
// Add ignoreUndefined
|
|
689
689
|
if (this.s.options.ignoreUndefined) {
|
|
690
690
|
options = Object.assign({}, options);
|
|
691
691
|
options.ignoreUndefined = this.s.options.ignoreUndefined;
|
|
@@ -713,7 +713,7 @@ Collection.prototype.replaceOne = function(filter, doc, options, callback) {
|
|
|
713
713
|
if (typeof options === 'function') (callback = options), (options = {});
|
|
714
714
|
options = Object.assign({}, options);
|
|
715
715
|
|
|
716
|
-
// Add
|
|
716
|
+
// Add ignoreUndefined
|
|
717
717
|
if (this.s.options.ignoreUndefined) {
|
|
718
718
|
options = Object.assign({}, options);
|
|
719
719
|
options.ignoreUndefined = this.s.options.ignoreUndefined;
|
|
@@ -749,7 +749,7 @@ Collection.prototype.updateMany = function(filter, update, options, callback) {
|
|
|
749
749
|
|
|
750
750
|
options = Object.assign({}, options);
|
|
751
751
|
|
|
752
|
-
// Add
|
|
752
|
+
// Add ignoreUndefined
|
|
753
753
|
if (this.s.options.ignoreUndefined) {
|
|
754
754
|
options = Object.assign({}, options);
|
|
755
755
|
options.ignoreUndefined = this.s.options.ignoreUndefined;
|
|
@@ -782,7 +782,7 @@ Collection.prototype.update = deprecate(function(selector, update, options, call
|
|
|
782
782
|
if (typeof options === 'function') (callback = options), (options = {});
|
|
783
783
|
options = options || {};
|
|
784
784
|
|
|
785
|
-
// Add
|
|
785
|
+
// Add ignoreUndefined
|
|
786
786
|
if (this.s.options.ignoreUndefined) {
|
|
787
787
|
options = Object.assign({}, options);
|
|
788
788
|
options.ignoreUndefined = this.s.options.ignoreUndefined;
|
|
@@ -829,7 +829,7 @@ Collection.prototype.deleteOne = function(filter, options, callback) {
|
|
|
829
829
|
if (typeof options === 'function') (callback = options), (options = {});
|
|
830
830
|
options = Object.assign({}, options);
|
|
831
831
|
|
|
832
|
-
// Add
|
|
832
|
+
// Add ignoreUndefined
|
|
833
833
|
if (this.s.options.ignoreUndefined) {
|
|
834
834
|
options = Object.assign({}, options);
|
|
835
835
|
options.ignoreUndefined = this.s.options.ignoreUndefined;
|
|
@@ -856,7 +856,7 @@ Collection.prototype.deleteMany = function(filter, options, callback) {
|
|
|
856
856
|
if (typeof options === 'function') (callback = options), (options = {});
|
|
857
857
|
options = Object.assign({}, options);
|
|
858
858
|
|
|
859
|
-
// Add
|
|
859
|
+
// Add ignoreUndefined
|
|
860
860
|
if (this.s.options.ignoreUndefined) {
|
|
861
861
|
options = Object.assign({}, options);
|
|
862
862
|
options.ignoreUndefined = this.s.options.ignoreUndefined;
|
|
@@ -885,7 +885,7 @@ Collection.prototype.remove = deprecate(function(selector, options, callback) {
|
|
|
885
885
|
if (typeof options === 'function') (callback = options), (options = {});
|
|
886
886
|
options = options || {};
|
|
887
887
|
|
|
888
|
-
// Add
|
|
888
|
+
// Add ignoreUndefined
|
|
889
889
|
if (this.s.options.ignoreUndefined) {
|
|
890
890
|
options = Object.assign({}, options);
|
|
891
891
|
options.ignoreUndefined = this.s.options.ignoreUndefined;
|
|
@@ -912,7 +912,7 @@ Collection.prototype.save = deprecate(function(doc, options, callback) {
|
|
|
912
912
|
if (typeof options === 'function') (callback = options), (options = {});
|
|
913
913
|
options = options || {};
|
|
914
914
|
|
|
915
|
-
// Add
|
|
915
|
+
// Add ignoreUndefined
|
|
916
916
|
if (this.s.options.ignoreUndefined) {
|
|
917
917
|
options = Object.assign({}, options);
|
|
918
918
|
options.ignoreUndefined = this.s.options.ignoreUndefined;
|
|
@@ -963,7 +963,7 @@ Collection.prototype.save = deprecate(function(doc, options, callback) {
|
|
|
963
963
|
* @param {boolean} [options.promoteBuffers=false] Promotes Binary BSON values to native Node Buffers.
|
|
964
964
|
* @param {(ReadPreference|string)} [options.readPreference] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
|
|
965
965
|
* @param {boolean} [options.partial=false] Specify if the cursor should return partial results when querying against a sharded system
|
|
966
|
-
* @param {number} [options.maxTimeMS] Number of
|
|
966
|
+
* @param {number} [options.maxTimeMS] Number of milliseconds to wait before aborting the query.
|
|
967
967
|
* @param {object} [options.collation] Specify collation (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields).
|
|
968
968
|
* @param {ClientSession} [options.session] optional session to use for this operation
|
|
969
969
|
* @param {Collection~resultCallback} [callback] The command result callback
|
|
@@ -1126,7 +1126,7 @@ Collection.prototype.createIndexes = function(indexSpecs, options, callback) {
|
|
|
1126
1126
|
* @param {number} [options.wtimeout] The write concern timeout.
|
|
1127
1127
|
* @param {boolean} [options.j=false] Specify a journal write concern.
|
|
1128
1128
|
* @param {ClientSession} [options.session] optional session to use for this operation
|
|
1129
|
-
* @param {number} [options.maxTimeMS] Number of
|
|
1129
|
+
* @param {number} [options.maxTimeMS] Number of milliseconds to wait before aborting the query.
|
|
1130
1130
|
* @param {Collection~resultCallback} [callback] The command result callback
|
|
1131
1131
|
* @return {Promise} returns Promise if no callback passed
|
|
1132
1132
|
*/
|
|
@@ -1146,7 +1146,7 @@ Collection.prototype.dropIndex = function(indexName, options, callback) {
|
|
|
1146
1146
|
* @method
|
|
1147
1147
|
* @param {Object} [options] Optional settings
|
|
1148
1148
|
* @param {ClientSession} [options.session] optional session to use for this operation
|
|
1149
|
-
* @param {number} [options.maxTimeMS] Number of
|
|
1149
|
+
* @param {number} [options.maxTimeMS] Number of milliseconds to wait before aborting the query.
|
|
1150
1150
|
* @param {Collection~resultCallback} [callback] The command result callback
|
|
1151
1151
|
* @return {Promise} returns Promise if no callback passed
|
|
1152
1152
|
*/
|
|
@@ -1318,7 +1318,7 @@ Collection.prototype.indexInformation = function(options, callback) {
|
|
|
1318
1318
|
* @param {boolean} [options.skip] The number of documents to skip for the count.
|
|
1319
1319
|
* @param {string} [options.hint] An index name hint for the query.
|
|
1320
1320
|
* @param {(ReadPreference|string)} [options.readPreference] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
|
|
1321
|
-
* @param {number} [options.maxTimeMS] Number of
|
|
1321
|
+
* @param {number} [options.maxTimeMS] Number of milliseconds to wait before aborting the query.
|
|
1322
1322
|
* @param {ClientSession} [options.session] optional session to use for this operation
|
|
1323
1323
|
* @param {Collection~countCallback} [callback] The command result callback
|
|
1324
1324
|
* @return {Promise} returns Promise if no callback passed
|
|
@@ -1398,7 +1398,7 @@ Collection.prototype.countDocuments = function(query, options, callback) {
|
|
|
1398
1398
|
* @param {object} query The query for filtering the set of documents to which we apply the distinct filter.
|
|
1399
1399
|
* @param {object} [options] Optional settings.
|
|
1400
1400
|
* @param {(ReadPreference|string)} [options.readPreference] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
|
|
1401
|
-
* @param {number} [options.maxTimeMS] Number of
|
|
1401
|
+
* @param {number} [options.maxTimeMS] Number of milliseconds to wait before aborting the query.
|
|
1402
1402
|
* @param {ClientSession} [options.session] optional session to use for this operation
|
|
1403
1403
|
* @param {Collection~resultCallback} [callback] The command result callback
|
|
1404
1404
|
* @return {Promise} returns Promise if no callback passed
|
package/lib/command_cursor.js
CHANGED
|
@@ -259,7 +259,7 @@ CommandCursor.prototype.get = CommandCursor.prototype.toArray;
|
|
|
259
259
|
/**
|
|
260
260
|
* Returns an array of documents. The caller is responsible for making sure that there
|
|
261
261
|
* is enough memory to store the results. Note that the array only contain partial
|
|
262
|
-
* results when this cursor had been
|
|
262
|
+
* results when this cursor had been previously accessed.
|
|
263
263
|
* @method CommandCursor.prototype.toArray
|
|
264
264
|
* @param {CommandCursor~toArrayResultCallback} [callback] The result callback.
|
|
265
265
|
* @throws {MongoError}
|
|
@@ -275,7 +275,7 @@ CommandCursor.prototype.get = CommandCursor.prototype.toArray;
|
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
277
|
* Iterates over all the documents for this cursor. As with **{cursor.toArray}**,
|
|
278
|
-
* not all of the elements will be iterated if this cursor had been
|
|
278
|
+
* not all of the elements will be iterated if this cursor had been previously accessed.
|
|
279
279
|
* In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike
|
|
280
280
|
* **{cursor.toArray}**, the cursor will only hold a maximum of batch size elements
|
|
281
281
|
* at any given time if batch size is specified. Otherwise, the caller is responsible
|
package/lib/cursor.js
CHANGED
|
@@ -693,7 +693,7 @@ Cursor.prototype.skip = function(value) {
|
|
|
693
693
|
|
|
694
694
|
/**
|
|
695
695
|
* Iterates over all the documents for this cursor. As with **{cursor.toArray}**,
|
|
696
|
-
* not all of the elements will be iterated if this cursor had been
|
|
696
|
+
* not all of the elements will be iterated if this cursor had been previously accessed.
|
|
697
697
|
* In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike
|
|
698
698
|
* **{cursor.toArray}**, the cursor will only hold a maximum of batch size elements
|
|
699
699
|
* at any given time if batch size is specified. Otherwise, the caller is responsible
|
|
@@ -811,7 +811,7 @@ Cursor.prototype.setReadPreference = function(readPreference) {
|
|
|
811
811
|
/**
|
|
812
812
|
* Returns an array of documents. The caller is responsible for making sure that there
|
|
813
813
|
* is enough memory to store the results. Note that the array only contains partial
|
|
814
|
-
* results when this cursor had been
|
|
814
|
+
* results when this cursor had been previously accessed. In that case,
|
|
815
815
|
* cursor.rewind() can be used to reset the cursor.
|
|
816
816
|
* @method
|
|
817
817
|
* @param {Cursor~toArrayResultCallback} [callback] The result callback.
|
|
@@ -845,7 +845,7 @@ Cursor.prototype.toArray = function(callback) {
|
|
|
845
845
|
* @param {object} [options] Optional settings.
|
|
846
846
|
* @param {number} [options.skip] The number of documents to skip.
|
|
847
847
|
* @param {number} [options.limit] The maximum amounts to count before aborting.
|
|
848
|
-
* @param {number} [options.maxTimeMS] Number of
|
|
848
|
+
* @param {number} [options.maxTimeMS] Number of milliseconds to wait before aborting the query.
|
|
849
849
|
* @param {string} [options.hint] An index name hint for the query.
|
|
850
850
|
* @param {(ReadPreference|string)} [options.readPreference] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
|
|
851
851
|
* @param {Cursor~countResultCallback} [callback] The result callback.
|
package/lib/db.js
CHANGED
|
@@ -113,7 +113,7 @@ const legalOptionNames = [
|
|
|
113
113
|
* @param {object} [options.pkFactory] A primary key factory object for generation of custom _id keys.
|
|
114
114
|
* @param {object} [options.promiseLibrary] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible
|
|
115
115
|
* @param {object} [options.readConcern] Specify a read concern for the collection. (only MongoDB 3.2 or higher supported)
|
|
116
|
-
* @param {
|
|
116
|
+
* @param {ReadConcernLevel} [options.readConcern.level='local'] Specify a read concern level for the collection operations (only MongoDB 3.2 or higher supported)
|
|
117
117
|
* @property {(Server|ReplSet|Mongos)} serverConfig Get the current db topology.
|
|
118
118
|
* @property {number} bufferMaxEntries Current bufferMaxEntries value for the database
|
|
119
119
|
* @property {string} databaseName The name of the database this instance represents.
|
|
@@ -355,7 +355,7 @@ const collectionKeys = [
|
|
|
355
355
|
* @param {boolean} [options.serializeFunctions=false] Serialize functions on any object.
|
|
356
356
|
* @param {boolean} [options.strict=false] Returns an error if the collection does not exist
|
|
357
357
|
* @param {object} [options.readConcern] Specify a read concern for the collection. (only MongoDB 3.2 or higher supported)
|
|
358
|
-
* @param {
|
|
358
|
+
* @param {ReadConcernLevel} [options.readConcern.level='local'] Specify a read concern level for the collection operations (only MongoDB 3.2 or higher supported)
|
|
359
359
|
* @param {Db~collectionResultCallback} [callback] The collection result callback
|
|
360
360
|
* @return {Collection} return the new Collection instance if not in strict mode
|
|
361
361
|
*/
|
|
@@ -595,7 +595,7 @@ Db.prototype.listCollections = function(filter, options) {
|
|
|
595
595
|
* @param {Code} code JavaScript to execute on server.
|
|
596
596
|
* @param {(object|array)} parameters The parameters for the call.
|
|
597
597
|
* @param {object} [options] Optional settings.
|
|
598
|
-
* @param {boolean} [options.nolock=false] Tell MongoDB not to block on the
|
|
598
|
+
* @param {boolean} [options.nolock=false] Tell MongoDB not to block on the evaluation of the javascript.
|
|
599
599
|
* @param {ClientSession} [options.session] optional session to use for this operation
|
|
600
600
|
* @param {Db~resultCallback} [callback] The results callback
|
|
601
601
|
* @deprecated Eval is deprecated on MongoDB 3.2 and forward
|
|
@@ -867,7 +867,7 @@ Db.prototype.setProfilingLevel = function(level, options, callback) {
|
|
|
867
867
|
};
|
|
868
868
|
|
|
869
869
|
/**
|
|
870
|
-
*
|
|
870
|
+
* Retrieve the current profiling information for MongoDB
|
|
871
871
|
*
|
|
872
872
|
* @param {Object} [options] Optional settings
|
|
873
873
|
* @param {ClientSession} [options.session] optional session to use for this operation
|
package/lib/gridfs/grid_store.js
CHANGED
|
@@ -65,7 +65,7 @@ const deprecationFn = deprecate(() => {},
|
|
|
65
65
|
*
|
|
66
66
|
* Modes
|
|
67
67
|
* - **"r"** - read only. This is the default mode.
|
|
68
|
-
* - **"w"** - write in truncate mode. Existing data will be
|
|
68
|
+
* - **"w"** - write in truncate mode. Existing data will be overwritten.
|
|
69
69
|
*
|
|
70
70
|
* @class
|
|
71
71
|
* @param {Db} db A database instance to interact with.
|
package/lib/mongo_client.js
CHANGED
|
@@ -46,6 +46,12 @@ const closeOperation = require('./operations/mongo_client_ops').closeOperation;
|
|
|
46
46
|
* });
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* A string specifying the level of a ReadConcern
|
|
51
|
+
* @typedef {'local'|'available'|'majority'|'linearizable'|'snapshot'} ReadConcernLevel
|
|
52
|
+
* @see https://docs.mongodb.com/manual/reference/read-concern/index.html#read-concern-levels
|
|
53
|
+
*/
|
|
54
|
+
|
|
49
55
|
/**
|
|
50
56
|
* Creates a new MongoClient instance
|
|
51
57
|
* @class
|
|
@@ -53,7 +59,7 @@ const closeOperation = require('./operations/mongo_client_ops').closeOperation;
|
|
|
53
59
|
* @param {object} [options] Optional settings
|
|
54
60
|
* @param {number} [options.poolSize=5] The maximum size of the individual server pool
|
|
55
61
|
* @param {boolean} [options.ssl=false] Enable SSL connection.
|
|
56
|
-
* @param {boolean} [options.sslValidate=
|
|
62
|
+
* @param {boolean} [options.sslValidate=false] Validate mongod server certificate against Certificate Authority
|
|
57
63
|
* @param {buffer} [options.sslCA=undefined] SSL Certificate store binary buffer
|
|
58
64
|
* @param {buffer} [options.sslCert=undefined] SSL Certificate binary buffer
|
|
59
65
|
* @param {buffer} [options.sslKey=undefined] SSL Key file binary buffer
|
|
@@ -88,7 +94,7 @@ const closeOperation = require('./operations/mongo_client_ops').closeOperation;
|
|
|
88
94
|
* @param {object} [options.pkFactory] A primary key factory object for generation of custom _id keys
|
|
89
95
|
* @param {object} [options.promiseLibrary] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible
|
|
90
96
|
* @param {object} [options.readConcern] Specify a read concern for the collection (only MongoDB 3.2 or higher supported)
|
|
91
|
-
* @param {
|
|
97
|
+
* @param {ReadConcernLevel} [options.readConcern.level='local'] Specify a read concern level for the collection operations (only MongoDB 3.2 or higher supported)
|
|
92
98
|
* @param {number} [options.maxStalenessSeconds=undefined] The max staleness to secondary reads (values under 10 seconds cannot be guaranteed)
|
|
93
99
|
* @param {string} [options.loggerLevel=undefined] The logging level (error/warn/info/debug)
|
|
94
100
|
* @param {object} [options.logger=undefined] Custom logger object
|
|
@@ -265,7 +271,7 @@ MongoClient.prototype.isConnected = function(options) {
|
|
|
265
271
|
* @param {object} [options] Optional settings
|
|
266
272
|
* @param {number} [options.poolSize=5] The maximum size of the individual server pool
|
|
267
273
|
* @param {boolean} [options.ssl=false] Enable SSL connection.
|
|
268
|
-
* @param {boolean} [options.sslValidate=
|
|
274
|
+
* @param {boolean} [options.sslValidate=false] Validate mongod server certificate against Certificate Authority
|
|
269
275
|
* @param {buffer} [options.sslCA=undefined] SSL Certificate store binary buffer
|
|
270
276
|
* @param {buffer} [options.sslCert=undefined] SSL Certificate binary buffer
|
|
271
277
|
* @param {buffer} [options.sslKey=undefined] SSL Key file binary buffer
|
|
@@ -300,7 +306,7 @@ MongoClient.prototype.isConnected = function(options) {
|
|
|
300
306
|
* @param {object} [options.pkFactory] A primary key factory object for generation of custom _id keys
|
|
301
307
|
* @param {object} [options.promiseLibrary] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible
|
|
302
308
|
* @param {object} [options.readConcern] Specify a read concern for the collection (only MongoDB 3.2 or higher supported)
|
|
303
|
-
* @param {
|
|
309
|
+
* @param {ReadConcernLevel} [options.readConcern.level='local'] Specify a read concern level for the collection operations (only MongoDB 3.2 or higher supported)
|
|
304
310
|
* @param {number} [options.maxStalenessSeconds=undefined] The max staleness to secondary reads (values under 10 seconds cannot be guaranteed)
|
|
305
311
|
* @param {string} [options.loggerLevel=undefined] The logging level (error/warn/info/debug)
|
|
306
312
|
* @param {object} [options.logger=undefined] Custom logger object
|
|
@@ -81,7 +81,7 @@ const groupFunction =
|
|
|
81
81
|
* @param {Collection~bulkWriteOpCallback} [callback] The command result callback
|
|
82
82
|
*/
|
|
83
83
|
function bulkWrite(coll, operations, options, callback) {
|
|
84
|
-
// Add
|
|
84
|
+
// Add ignoreUndefined
|
|
85
85
|
if (coll.s.options.ignoreUndefined) {
|
|
86
86
|
options = Object.assign({}, options);
|
|
87
87
|
options.ignoreUndefined = coll.s.options.ignoreUndefined;
|
package/lib/operations/db_ops.js
CHANGED
|
@@ -601,7 +601,7 @@ function listCollectionsTransforms(databaseName) {
|
|
|
601
601
|
}
|
|
602
602
|
|
|
603
603
|
/**
|
|
604
|
-
*
|
|
604
|
+
* Retrieve the current profiling information for MongoDB
|
|
605
605
|
*
|
|
606
606
|
* @method
|
|
607
607
|
* @param {Db} db The Db instance on which to retrieve the profiling info.
|
|
@@ -634,7 +634,7 @@ function generateCredentials(client, username, password, options) {
|
|
|
634
634
|
options = Object.assign({}, options);
|
|
635
635
|
|
|
636
636
|
// the default db to authenticate against is 'self'
|
|
637
|
-
// if
|
|
637
|
+
// if authenticate is called from a retry context, it may be another one, like admin
|
|
638
638
|
const source = options.authSource || options.authdb || options.dbName;
|
|
639
639
|
|
|
640
640
|
// authMechanism
|
package/lib/topologies/mongos.js
CHANGED
|
@@ -70,7 +70,7 @@ var legalOptionNames = [
|
|
|
70
70
|
* @param {number} [options.acceptableLatencyMS=15] Cutoff latency point in MS for MongoS proxy selection
|
|
71
71
|
* @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support)
|
|
72
72
|
* @param {boolean|function} [options.checkServerIdentity=true] Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function.
|
|
73
|
-
* @param {boolean} [options.sslValidate=
|
|
73
|
+
* @param {boolean} [options.sslValidate=false] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
74
74
|
* @param {array} [options.sslCA] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
75
75
|
* @param {array} [options.sslCRL] Array of revocation certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
76
76
|
* @param {string} [options.ciphers] Passed directly through to tls.createSecureContext. See https://nodejs.org/dist/latest-v9.x/docs/api/tls.html#tls_tls_createsecurecontext_options for more info.
|
|
@@ -80,7 +80,7 @@ var legalOptionNames = [
|
|
|
80
80
|
* @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.
|
|
81
81
|
* @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support)
|
|
82
82
|
* @param {boolean|function} [options.checkServerIdentity=true] Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function.
|
|
83
|
-
* @param {boolean} [options.sslValidate=
|
|
83
|
+
* @param {boolean} [options.sslValidate=false] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
84
84
|
* @param {array} [options.sslCA] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
85
85
|
* @param {array} [options.sslCRL] Array of revocation certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
86
86
|
* @param {(Buffer|string)} [options.sslCert] String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher.
|
package/lib/topologies/server.js
CHANGED
|
@@ -70,7 +70,7 @@ var legalOptionNames = [
|
|
|
70
70
|
* @param {object} [options] Optional settings.
|
|
71
71
|
* @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.
|
|
72
72
|
* @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support)
|
|
73
|
-
* @param {boolean} [options.sslValidate=
|
|
73
|
+
* @param {boolean} [options.sslValidate=false] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
74
74
|
* @param {boolean|function} [options.checkServerIdentity=true] Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function.
|
|
75
75
|
* @param {array} [options.sslCA] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
|
|
76
76
|
* @param {array} [options.sslCRL] Array of revocation certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)
|
package/lib/url_parser.js
CHANGED
|
@@ -355,7 +355,7 @@ function parseConnectionString(url, options) {
|
|
|
355
355
|
if (_host.indexOf('?') !== -1) _host = _host.split(/\?/)[0];
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
// No entry returned for duplicate
|
|
358
|
+
// No entry returned for duplicate server
|
|
359
359
|
if (deduplicatedServers[_host + '_' + _port]) return null;
|
|
360
360
|
deduplicatedServers[_host + '_' + _port] = 1;
|
|
361
361
|
|
package/lib/utils.js
CHANGED
|
@@ -114,7 +114,7 @@ var checkCollectionName = function checkCollectionName(collectionName) {
|
|
|
114
114
|
throw new MongoError("collection names must not start or end with '.'");
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
// Validate that we are not passing 0x00 in the
|
|
117
|
+
// Validate that we are not passing 0x00 in the collection name
|
|
118
118
|
if (collectionName.indexOf('\x00') !== -1) {
|
|
119
119
|
throw new MongoError('collection names cannot contain a null character');
|
|
120
120
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongodb",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"description": "The official MongoDB driver for Node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"official"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"mongodb-core": "3.2.
|
|
20
|
+
"mongodb-core": "^3.2.3",
|
|
21
21
|
"safe-buffer": "^5.1.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|