Skip to content

Commit a15855f

Browse files
committed
fix incorrect reset of populate _docs property
1 parent 3187842 commit a15855f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ exports.merge = function merge(to, from, options, path) {
268268
if (isPOJO(from[key])) {
269269
to[key] = { ...from[key] };
270270
} else if (Array.isArray(from[key])) {
271-
to[key] = from[key].slice();
271+
to[key] = [...from[key]];
272272
} else {
273273
to[key] = from[key];
274274
}
@@ -508,7 +508,7 @@ exports.populate = function populate(path, select, model, match, options, subPop
508508
if (path instanceof PopulateOptions) {
509509
// If reusing old populate docs, avoid reusing `_docs` because that may
510510
// lead to bugs and memory leaks. See gh-11641
511-
path._docs = [];
511+
path._docs = {};
512512
path._childDocs = [];
513513
return [path];
514514
}

0 commit comments

Comments
 (0)