Skip to content

Commit

Permalink
fix(map): handle cloning a schema that has a map of subdocuments
Browse files Browse the repository at this point in the history
Fix #8357
  • Loading branch information
vkarpov15 committed Dec 1, 2019
1 parent 6248073 commit a567816
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/schema/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ class Map extends SchemaType {

return new MongooseMap(val, this.path, doc, this.$__schemaType);
}

clone() {
const schematype = super.clone();

if (this.$__schemaType != null) {
schematype.$__schemaType = this.$__schemaType.clone();
}
return schematype;
}
}

Map.prototype.OptionsConstructor = SchemaMapOptions;
Expand Down

0 comments on commit a567816

Please sign in to comment.