Non-strict schema properties are not accessible after loading document #10828
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?
Properties on a non-strict schema that are accessed directly (e.g.
mySchema.prop
) yieldundefined
even though they exist and have values.Note that I am defining the blank schema like this intentionally, as suggested to me earlier in #10383
If the current behavior is a bug, please provide the steps to reproduce.
Result:
For some reason, the properties are not accessible/yield undefined when accessed directly.
Using
toObject()
first works and includes all the properties.What is the expected behavior?
Expected:
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node 16, Mongoose 6.0.7, MongoDB 4.2.8
The text was updated successfully, but these errors were encountered: