validate doesn't throw any error with nested object in schema #7143
Labels
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
Milestone
Hey!
I am wondering why the script below doesn't throw any validation error.
I set strict to throw, if I tried to add a key who doesn't exist in the schema it should throw an error which is not the case here.
Solution Found:
If I remove the required for
jerome
, it works fine. I think the issue may come in the way mongoose handle nested object, for example in this case if I create a subSchema like that, it's works fine:standalone strict:
"mongoose": "5.2.18",
nodejs version: v10.6.0
Thank you 👍
The text was updated successfully, but these errors were encountered: