Skip to content

Commit

Permalink
fix(update): respect storeSubdocValidationError option with update va…
Browse files Browse the repository at this point in the history
…lidators

Fix #9172
  • Loading branch information
vkarpov15 committed Jul 3, 2020
1 parent f3be507 commit 86e2791
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/helpers/updateValidators.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,14 @@ module.exports = function(query, schema, castedDoc, options, callback) {
return callback(null);
}
}

schemaPath.doValidate(v, function(err) {
if (schemaPath.schema != null &&
schemaPath.schema.options.storeSubdocValidationError === false &&
err instanceof ValidationError) {
return callback(null);
}

if (err) {
err.path = updates[i];
validationErrors.push(err);
Expand Down

0 comments on commit 86e2791

Please sign in to comment.