mongodb 3.0.4 → 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/.eslintrc +2 -1
- package/CHANGES_3.0.0.md +28 -0
- package/CODE_OF_CONDUCT.md +80 -0
- package/CONTRIBUTING.md +29 -0
- package/HISTORY.md +52 -0
- package/conf.json +0 -1
- package/index.js +6 -4
- package/lib/admin.js +6 -49
- package/lib/aggregation_cursor.js +7 -46
- package/lib/apm.js +21 -629
- package/lib/bulk/common.js +0 -23
- package/lib/bulk/ordered.js +15 -22
- package/lib/bulk/unordered.js +15 -22
- package/lib/collection.js +60 -182
- package/lib/command_cursor.js +11 -34
- package/lib/cursor.js +48 -90
- package/lib/db.js +55 -124
- package/lib/gridfs/grid_store.js +12 -61
- package/lib/mongo_client.js +37 -31
- package/lib/topologies/mongos.js +47 -41
- package/lib/topologies/replset.js +46 -39
- package/lib/topologies/server.js +46 -40
- package/lib/topologies/topology_base.js +2 -4
- package/lib/url_parser.js +10 -0
- package/lib/utils.js +52 -5
- package/package.json +5 -5
- package/lib/metadata.js +0 -70
- package/yarn.lock +0 -3904
package/lib/bulk/ordered.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
const common = require('./common');
|
|
4
|
+
const utils = require('../utils');
|
|
5
|
+
const toError = require('../utils').toError;
|
|
6
|
+
const handleCallback = require('../utils').handleCallback;
|
|
7
|
+
const shallowClone = utils.shallowClone;
|
|
8
|
+
const BulkWriteResult = common.BulkWriteResult;
|
|
9
|
+
const ObjectID = require('mongodb-core').BSON.ObjectID;
|
|
10
|
+
const BSON = require('mongodb-core').BSON;
|
|
11
|
+
const Batch = common.Batch;
|
|
12
|
+
const mergeBatchResults = common.mergeBatchResults;
|
|
13
|
+
const executeOperation = utils.executeOperation;
|
|
14
|
+
const BulkWriteError = require('./common').BulkWriteError;
|
|
15
|
+
const applyWriteConcern = utils.applyWriteConcern;
|
|
16
16
|
|
|
17
17
|
var bson = new BSON([
|
|
18
18
|
BSON.Binary,
|
|
@@ -247,7 +247,8 @@ function OrderedBulkOperation(topology, collection, options) {
|
|
|
247
247
|
: 1000;
|
|
248
248
|
|
|
249
249
|
// Get the write concern
|
|
250
|
-
var writeConcern =
|
|
250
|
+
var writeConcern = applyWriteConcern(shallowClone(options), { collection: collection }, options);
|
|
251
|
+
writeConcern = writeConcern.writeConcern;
|
|
251
252
|
|
|
252
253
|
// Get the promiseLibrary
|
|
253
254
|
var promiseLibrary = options.promiseLibrary || Promise;
|
|
@@ -309,12 +310,6 @@ function OrderedBulkOperation(topology, collection, options) {
|
|
|
309
310
|
};
|
|
310
311
|
}
|
|
311
312
|
|
|
312
|
-
var define = (OrderedBulkOperation.define = new Define(
|
|
313
|
-
'OrderedBulkOperation',
|
|
314
|
-
OrderedBulkOperation,
|
|
315
|
-
false
|
|
316
|
-
));
|
|
317
|
-
|
|
318
313
|
OrderedBulkOperation.prototype.raw = function(op) {
|
|
319
314
|
var key = Object.keys(op)[0];
|
|
320
315
|
|
|
@@ -602,8 +597,6 @@ OrderedBulkOperation.prototype.execute = function(_writeConcern, options, callba
|
|
|
602
597
|
return executeOperation(this.s.topology, executeCommands, [this, options, callback]);
|
|
603
598
|
};
|
|
604
599
|
|
|
605
|
-
define.classMethod('execute', { callback: true, promise: false });
|
|
606
|
-
|
|
607
600
|
/**
|
|
608
601
|
* Returns an unordered batch object
|
|
609
602
|
* @ignore
|
package/lib/bulk/unordered.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
const common = require('./common');
|
|
4
|
+
const utils = require('../utils');
|
|
5
|
+
const toError = require('../utils').toError;
|
|
6
|
+
const handleCallback = require('../utils').handleCallback;
|
|
7
|
+
const shallowClone = utils.shallowClone;
|
|
8
|
+
const BulkWriteResult = common.BulkWriteResult;
|
|
9
|
+
const ObjectID = require('mongodb-core').BSON.ObjectID;
|
|
10
|
+
const BSON = require('mongodb-core').BSON;
|
|
11
|
+
const Batch = common.Batch;
|
|
12
|
+
const mergeBatchResults = common.mergeBatchResults;
|
|
13
|
+
const executeOperation = utils.executeOperation;
|
|
14
|
+
const BulkWriteError = require('./common').BulkWriteError;
|
|
15
|
+
const applyWriteConcern = utils.applyWriteConcern;
|
|
16
16
|
|
|
17
17
|
var bson = new BSON([
|
|
18
18
|
BSON.Binary,
|
|
@@ -257,7 +257,8 @@ var UnorderedBulkOperation = function(topology, collection, options) {
|
|
|
257
257
|
: 1000;
|
|
258
258
|
|
|
259
259
|
// Get the write concern
|
|
260
|
-
var writeConcern =
|
|
260
|
+
var writeConcern = applyWriteConcern(shallowClone(options), { collection: collection }, options);
|
|
261
|
+
writeConcern = writeConcern.writeConcern;
|
|
261
262
|
|
|
262
263
|
// Get the promiseLibrary
|
|
263
264
|
var promiseLibrary = options.promiseLibrary || Promise;
|
|
@@ -318,12 +319,6 @@ var UnorderedBulkOperation = function(topology, collection, options) {
|
|
|
318
319
|
};
|
|
319
320
|
};
|
|
320
321
|
|
|
321
|
-
var define = (UnorderedBulkOperation.define = new Define(
|
|
322
|
-
'UnorderedBulkOperation',
|
|
323
|
-
UnorderedBulkOperation,
|
|
324
|
-
false
|
|
325
|
-
));
|
|
326
|
-
|
|
327
322
|
/**
|
|
328
323
|
* Add a single insert document to the bulk operation
|
|
329
324
|
*
|
|
@@ -616,8 +611,6 @@ UnorderedBulkOperation.prototype.execute = function(_writeConcern, options, call
|
|
|
616
611
|
return executeOperation(this.s.topology, executeBatches, [this, options, callback]);
|
|
617
612
|
};
|
|
618
613
|
|
|
619
|
-
define.classMethod('execute', { callback: true, promise: false });
|
|
620
|
-
|
|
621
614
|
/**
|
|
622
615
|
* Returns an unordered batch object
|
|
623
616
|
* @ignore
|