summaryrefslogtreecommitdiff
path: root/src/mongo/shell/bulk_api.js
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:20:35 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-27 11:02:23 -0400
commit134a4083953270e8a11430395357fb70a29047ad (patch)
treedd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /src/mongo/shell/bulk_api.js
parent1e46b5049003f427047e723ea5fab15b5a9253ca (diff)
downloadmongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'src/mongo/shell/bulk_api.js')
-rw-r--r--src/mongo/shell/bulk_api.js26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/mongo/shell/bulk_api.js b/src/mongo/shell/bulk_api.js
index eac31f7a871..eac2c063374 100644
--- a/src/mongo/shell/bulk_api.js
+++ b/src/mongo/shell/bulk_api.js
@@ -2,7 +2,6 @@
// Scope for the function
//
var _bulk_api_module = (function() {
-
// Batch types
var NONE = 0;
var INSERT = 1;
@@ -37,7 +36,6 @@ var _bulk_api_module = (function() {
* Accepts { w : x, j : x, wtimeout : x, fsync: x } or w, wtimeout, j
*/
var WriteConcern = function(wValue, wTimeout, jValue) {
-
if (!(this instanceof WriteConcern)) {
var writeConcern = Object.create(WriteConcern.prototype);
WriteConcern.apply(writeConcern, arguments);
@@ -97,7 +95,6 @@ var _bulk_api_module = (function() {
this.shellPrint = function() {
return this.toString();
};
-
};
/**
@@ -107,7 +104,6 @@ var _bulk_api_module = (function() {
* are used to filter the WriteResult to only include relevant result fields.
*/
var WriteResult = function(bulkResult, singleBatchType, writeConcern) {
-
if (!(this instanceof WriteResult))
return new WriteResult(bulkResult, singleBatchType, writeConcern);
@@ -217,7 +213,6 @@ var _bulk_api_module = (function() {
* Wraps the result for the commands
*/
var BulkWriteResult = function(bulkResult, singleBatchType, writeConcern) {
-
if (!(this instanceof BulkWriteResult) && !(this instanceof BulkWriteError))
return new BulkWriteResult(bulkResult, singleBatchType, writeConcern);
@@ -354,7 +349,6 @@ var _bulk_api_module = (function() {
* Represents a bulk write error, identical to a BulkWriteResult but thrown
*/
var BulkWriteError = function(bulkResult, singleBatchType, writeConcern, message) {
-
if (!(this instanceof BulkWriteError))
return new BulkWriteError(bulkResult, singleBatchType, writeConcern, message);
@@ -397,7 +391,6 @@ var _bulk_api_module = (function() {
* Wraps a command error
*/
var WriteCommandError = function(commandError) {
-
if (!(this instanceof WriteCommandError))
return new WriteCommandError(commandError);
@@ -607,7 +600,6 @@ var _bulk_api_module = (function() {
// Add to internal list of documents
var addToOperationsList = function(docType, document) {
-
if (Array.isArray(document))
throw Error("operation passed in cannot be an Array");
@@ -638,7 +630,7 @@ var _bulk_api_module = (function() {
* Otherwise, returns the same object passed.
*/
var addIdIfNeeded = function(obj) {
- if (typeof(obj._id) == "undefined" && !Array.isArray(obj)) {
+ if (typeof (obj._id) == "undefined" && !Array.isArray(obj)) {
var tmp = obj; // don't want to modify input
obj = {_id: new ObjectId()};
for (var key in tmp) {
@@ -812,7 +804,6 @@ var _bulk_api_module = (function() {
//
// Merge write command result into aggregated results object
var mergeBatchResults = function(batch, bulkResult, result) {
-
// If we have an insert Batch type
if (batch.batchType == INSERT) {
bulkResult.nInserted = bulkResult.nInserted + result.n;
@@ -1009,8 +1000,8 @@ var _bulk_api_module = (function() {
} else if (code == 19900 || // No longer primary
code == 16805 || // replicatedToNum no longer primary
code == 14330 || // gle wmode changed; invalid
- code == NOT_MASTER ||
- code == UNKNOWN_REPL_WRITE_CONCERN || code == WRITE_CONCERN_FAILED) {
+ code == NOT_MASTER || code == UNKNOWN_REPL_WRITE_CONCERN ||
+ code == WRITE_CONCERN_FAILED) {
extractedErr.wcError = {code: code, errmsg: errMsg};
} else if (!isOK) {
// This is a GLE failure we don't understand
@@ -1037,7 +1028,6 @@ var _bulk_api_module = (function() {
// Execute the operations, serially
var executeBatchWithLegacyOps = function(batch) {
-
var batchResult = {n: 0, writeErrors: [], upserted: []};
var extractedErr = null;
@@ -1113,10 +1103,11 @@ var _bulk_api_module = (function() {
bsonWoCompare(writeConcern, {w: 0}) != 0;
extractedErr = null;
- if (needToEnforceWC && (batchResult.writeErrors.length == 0 ||
- (!ordered &&
- // not all errored.
- batchResult.writeErrors.length < batch.operations.length))) {
+ if (needToEnforceWC &&
+ (batchResult.writeErrors.length == 0 ||
+ (!ordered &&
+ // not all errored.
+ batchResult.writeErrors.length < batch.operations.length))) {
// if last write errored
if (batchResult.writeErrors.length > 0 &&
batchResult.writeErrors[batchResult.writeErrors.length - 1].index ==
@@ -1237,7 +1228,6 @@ var _bulk_api_module = (function() {
};
return module;
-
})();
// Globals