Pre 'findOneAndUpdate' hooks not working for array of child schemas #12694
Labels
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
Milestone
Prerequisites
Mongoose version
6.7.2
Node.js version
14.16.1
MongoDB server version
4.11.0
Typescript version (if applicable)
No response
Description
Having a
childSchema
and using it inside an array on themainSchema
and then callingfindOneAndUpdate
on the model fires thefindOneAndUpdate
pre-hook on themainSchema
but not on thechildSchema
.Steps to Reproduce
Expected Behavior
I would expect the console to log
fired.1
andfired.2
but the pre-hook is only firing on themainSchema
. Also triedsave
,update
andupdateOne
pre-hooks onchildSchema
without luck. Is this intended behavior or a bug?The text was updated successfully, but these errors were encountered: