Skip to content

Commit

Permalink
refactor: be slightly more defensive about setting document arrays
Browse files Browse the repository at this point in the history
Re: #7472
  • Loading branch information
vkarpov15 committed Feb 5, 2019
1 parent e5948b8 commit 42aa401
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/types/documentarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ function MongooseDocumentArray(values, path, doc) {
};

if (Array.isArray(values)) {
if (values instanceof CoreMongooseArray) {
if (values instanceof CoreMongooseArray &&
values._path === path &&
values._parent === doc) {
props._atomics = Object.assign({}, values._atomics);
}
values.forEach(v => {
Expand Down

0 comments on commit 42aa401

Please sign in to comment.