parent() and ownerDocument() do not work when subdoc array is initialized using default
schema path option
#8509
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 (breaking change)
What is the current behavior?
When using the
default
schema path option to create an array with a single subdoc, usingparent()
andownerDocument()
in the child schema's middleware seems to behave incorrectly. Encountered this issue when upgrading from mongoose 5.2.18 (where it was working as expected) to 5.8.7. I believe the changes that caused this change in behaviour happened in 5.3.x and 5.4.x.If the current behavior is a bug, please provide the steps to reproduce.
The console output is:
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
node 8.15.0
mongoose 5.8.7 (was working as expected in 5.2.18)
MongoDB 3.6.10
The text was updated successfully, but these errors were encountered: