Skip to content

Commit

Permalink
fix(document): clean modified subpaths when setting nested path to nu…
Browse files Browse the repository at this point in the history
…ll after modifying subpaths

Fix #11764
  • Loading branch information
vkarpov15 committed May 15, 2022
1 parent b7b2715 commit c2bd9a9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,10 @@ Document.prototype.$set = function $set(path, val, type, options) {

if (!schema) {
this.$__set(pathToMark, path, options, constructing, parts, schema, val, priorVal);

if (pathType === 'nested' && val == null) {
cleanModifiedSubpaths(this, path);
}
return this;
}

Expand Down

0 comments on commit c2bd9a9

Please sign in to comment.