Cloning schema with 'map' type attribute breaks validation when 'of' set to schema definition #8357
Labels
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
Milestone
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Cloning a schema
Schema.prototype.clone()
containing a 'map' type attribute with 'of' set to a new embedded schema breaks validation.Note: a workaround is to create a new schema and use
Schema.prototype.add()
to first add the schema to be cloned and then add additional attributes - what is the difference between usingbaseSchema.clone()
versus(new mongoose.Schema()).add(baseSchema)
?If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
Should correctly clone (or reference?) the embedded map type schema(s)
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js 10.16.0
Mongoose 5.7.11
MongoDB 4.0.3
The text was updated successfully, but these errors were encountered: