summaryrefslogtreecommitdiff
path: root/src/mongo/shell/bulk_api.js
diff options
context:
space:
mode:
authorMihai Andrei <mihai.andrei@10gen.com>2020-07-02 19:21:35 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-07 13:38:05 +0000
commite87f6f53c58a75229b40fff7b32de202f2dcccc7 (patch)
treeeafb77ccd24ee11879f904c042eec41e4a3ad76e /src/mongo/shell/bulk_api.js
parentff4465b905b331fc82edb8194092917ad0c7255f (diff)
downloadmongo-e87f6f53c58a75229b40fff7b32de202f2dcccc7.tar.gz
SERVER-48781 Introduce 'DocumentValidationErrorExtraInfo' and shell support for document validation errors
Diffstat (limited to 'src/mongo/shell/bulk_api.js')
-rw-r--r--src/mongo/shell/bulk_api.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/shell/bulk_api.js b/src/mongo/shell/bulk_api.js
index eac2c063374..0b880175648 100644
--- a/src/mongo/shell/bulk_api.js
+++ b/src/mongo/shell/bulk_api.js
@@ -187,6 +187,10 @@ var _bulk_api_module = (function() {
result.writeError = {};
result.writeError.code = this.getWriteError().code;
result.writeError.errmsg = this.getWriteError().errmsg;
+ let errInfo = this.getWriteError().errInfo;
+ if (errInfo) {
+ result.writeError.errInfo = errInfo;
+ }
}
if (this.getWriteConcernError() != null) {
@@ -438,6 +442,9 @@ var _bulk_api_module = (function() {
defineReadOnlyProperty(this, "code", err.code);
defineReadOnlyProperty(this, "index", err.index);
defineReadOnlyProperty(this, "errmsg", err.errmsg);
+ // errInfo field is optional.
+ if (err.hasOwnProperty("errInfo"))
+ defineReadOnlyProperty(this, "errInfo", err.errInfo);
//
// Define access methods
@@ -851,6 +858,10 @@ var _bulk_api_module = (function() {
errmsg: result.writeErrors[i].errmsg,
op: batch.operations[result.writeErrors[i].index]
};
+ var errInfo = result.writeErrors[i].errInfo;
+ if (errInfo) {
+ writeError['errInfo'] = errInfo;
+ }
bulkResult.writeErrors.push(new WriteError(writeError));
}