diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2014-03-12 16:19:01 -0400 |
---|---|---|
committer | Scott Hernandez <scotthernandez@gmail.com> | 2014-03-12 22:36:19 -0400 |
commit | 4c1db9421bd72fdac754ae007e6197b42d9ed5c6 (patch) | |
tree | c04e616c0bdc24acc0f26dc8bd01ddc925582e96 /src/mongo/shell/bulk_api.js | |
parent | 5b33dcf8eca51d1356d80099ef45276f55353dfc (diff) | |
download | mongo-4c1db9421bd72fdac754ae007e6197b42d9ed5c6.tar.gz |
SERVER-13001: exclude nModified from legacy write results
Diffstat (limited to 'src/mongo/shell/bulk_api.js')
-rw-r--r-- | src/mongo/shell/bulk_api.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mongo/shell/bulk_api.js b/src/mongo/shell/bulk_api.js index 70b34b6341d..f4b2a8c3ca7 100644 --- a/src/mongo/shell/bulk_api.js +++ b/src/mongo/shell/bulk_api.js @@ -111,8 +111,10 @@ var _bulk_api_module = (function() { if(singleBatch && singleBatch.batchType == UPDATE) { result.nMatched = this.nMatched; result.nUpserted = this.nUpserted; - result.nModified = this.nModified; - + + if(this.nModified != undefined) + result.nModified = this.nModified; + if(Array.isArray(bulkResult.upserted) && bulkResult.upserted.length == 1) { result._id = bulkResult.upserted[0]._id; @@ -640,10 +642,13 @@ var _bulk_api_module = (function() { // If we have an update Batch type if(batch.batchType == UPDATE) { - var nModified = ('nModified' in result)? result.nModified: 0; bulkResult.nUpserted = bulkResult.nUpserted + nUpserted; bulkResult.nMatched = bulkResult.nMatched + (result.n - nUpserted); - bulkResult.nModified = bulkResult.nModified + nModified; + if(result.nModified == undefined) { + bulkResult.nModified = undefined; + } else if(bulkResult.nModified != undefined) { + bulkResult.nModified = bulkResult.nModified + result.nModified; + } } if(Array.isArray(result.writeErrors)) { @@ -832,7 +837,6 @@ var _bulk_api_module = (function() { var batchResult = { n: 0 - , nModified: 0 , writeErrors: [] , upserted: [] }; |