Skip to content

Commit

Permalink
fix incorrect reset of populate _docs property
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed May 9, 2024
1 parent 3187842 commit a15855f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ exports.merge = function merge(to, from, options, path) {
if (isPOJO(from[key])) {
to[key] = { ...from[key] };
} else if (Array.isArray(from[key])) {
to[key] = from[key].slice();
to[key] = [...from[key]];
} else {
to[key] = from[key];
}
Expand Down Expand Up @@ -508,7 +508,7 @@ exports.populate = function populate(path, select, model, match, options, subPop
if (path instanceof PopulateOptions) {
// If reusing old populate docs, avoid reusing `_docs` because that may
// lead to bugs and memory leaks. See gh-11641
path._docs = [];
path._docs = {};
path._childDocs = [];
return [path];
}
Expand Down

0 comments on commit a15855f

Please sign in to comment.