Skip to content

Commit fd94cd1

Browse files
committed
Update schema.js
1 parent 14c9c44 commit fd94cd1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/schema.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,8 @@ Schema.prototype._clone = function _clone(Constructor) {
412412
s.s.hooks = this.s.hooks.clone();
413413

414414
s.tree = clone(this.tree);
415-
// recursion is triggered here
416415
s.paths = Object.fromEntries(
417-
Object.entries(this.paths).map(([key, value]) => ([key, value.$isSingleNested ? value.clone() : value]))
416+
Object.entries(this.paths).map(([key, value]) => ([key, !value.$isMongooseDocumentArray ? value.clone() : value]))
418417
);
419418
s.nested = clone(this.nested);
420419
s.subpaths = clone(this.subpaths);

0 commit comments

Comments
 (0)