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.
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var common = require('./common'),
4
- utils = require('../utils'),
5
- toError = require('../utils').toError,
6
- handleCallback = require('../utils').handleCallback,
7
- shallowClone = utils.shallowClone,
8
- BulkWriteResult = common.BulkWriteResult,
9
- ObjectID = require('mongodb-core').BSON.ObjectID,
10
- Define = require('../metadata'),
11
- BSON = require('mongodb-core').BSON,
12
- Batch = common.Batch,
13
- mergeBatchResults = common.mergeBatchResults,
14
- executeOperation = require('../utils').executeOperation,
15
- BulkWriteError = require('./common').BulkWriteError;
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 = common.writeConcern(shallowClone(options), collection, options);
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
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var common = require('./common'),
4
- utils = require('../utils'),
5
- toError = require('../utils').toError,
6
- handleCallback = require('../utils').handleCallback,
7
- shallowClone = utils.shallowClone,
8
- BulkWriteResult = common.BulkWriteResult,
9
- ObjectID = require('mongodb-core').BSON.ObjectID,
10
- BSON = require('mongodb-core').BSON,
11
- Define = require('../metadata'),
12
- Batch = common.Batch,
13
- mergeBatchResults = common.mergeBatchResults,
14
- executeOperation = require('../utils').executeOperation,
15
- BulkWriteError = require('./common').BulkWriteError;
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 = common.writeConcern(shallowClone(options), collection, options);
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