diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2019-04-15 19:03:44 -0400 |
---|---|---|
committer | Gabriel Russell <gabriel.russell@mongodb.com> | 2019-04-24 16:58:01 -0400 |
commit | e3e31d97772cca5d23a23180ceb9161fbf4e7736 (patch) | |
tree | b98ca9a03bf5fdbacbd438cf5de63e5c4232c5a0 /src/mongo/shell/bulk_api.js | |
parent | 833dc84bc7f784e70e8a10f21c432745fbc24040 (diff) | |
download | mongo-e3e31d97772cca5d23a23180ceb9161fbf4e7736.tar.gz |
SERVER-40461 implement WriteResult._id for upserts
Diffstat (limited to 'src/mongo/shell/bulk_api.js')
-rw-r--r-- | src/mongo/shell/bulk_api.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/shell/bulk_api.js b/src/mongo/shell/bulk_api.js index 39696344362..82d3c861cc9 100644 --- a/src/mongo/shell/bulk_api.js +++ b/src/mongo/shell/bulk_api.js @@ -118,6 +118,9 @@ var _bulk_api_module = (function() { defineReadOnlyProperty(this, "nMatched", bulkResult.nMatched); defineReadOnlyProperty(this, "nModified", bulkResult.nModified); defineReadOnlyProperty(this, "nRemoved", bulkResult.nRemoved); + if (bulkResult.upserted.length > 0) { + defineReadOnlyProperty(this, "_id", bulkResult.upserted[bulkResult.upserted.length - 1]._id); + } // // Define access methods |