Skip to content

Commit

Permalink
fix(subdocument): make subdocument#isModified use parent document's i…
Browse files Browse the repository at this point in the history
…sModified

Fix #8223
  • Loading branch information
vkarpov15 committed Oct 11, 2019
1 parent 54db026 commit 327b47a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/types/subdocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ Subdocument.prototype.markModified = function(path) {
}
};

Subdocument.prototype.isModified = function(paths, modifiedPaths) {
if (this.$parent && this.$basePath) {
paths = (Array.isArray(paths) ? paths : paths.split(' ')).
map(p => [this.$basePath, p].join('.'));
return this.$parent.isModified(paths, modifiedPaths);
}

return Document.prototype.isModified(paths, modifiedPaths);
};

/**
* Marks a path as valid, removing existing validation errors.
*
Expand Down

0 comments on commit 327b47a

Please sign in to comment.