Populating a field of the items in an array, adds the field to every item regardless of its schema #10599
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Populating an array with multiple discriminators adds the field as null or empty array even when the item schema doesn't have the field defined. This happens when the populated field is either an array or a virtual.
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
result
should be:result
is:What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Nodejs: 12.21.0
mongoose: 5.12.1
mongodb: 3.2.22
The text was updated successfully, but these errors were encountered: