Skip to content

Commit

Permalink
Update schema.js
Browse files Browse the repository at this point in the history
  • Loading branch information
IslandRhythms committed Nov 9, 2023
1 parent 14c9c44 commit fd94cd1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,8 @@ Schema.prototype._clone = function _clone(Constructor) {
s.s.hooks = this.s.hooks.clone();

s.tree = clone(this.tree);
// recursion is triggered here
s.paths = Object.fromEntries(
Object.entries(this.paths).map(([key, value]) => ([key, value.$isSingleNested ? value.clone() : value]))
Object.entries(this.paths).map(([key, value]) => ([key, !value.$isMongooseDocumentArray ? value.clone() : value]))
);
s.nested = clone(this.nested);
s.subpaths = clone(this.subpaths);
Expand Down

0 comments on commit fd94cd1

Please sign in to comment.