Setting global strictQuery doesn't work after schemas are created #12703
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Prerequisites
Mongoose version
6.7.2
Node.js version
16.x
MongoDB server version
6.x
Typescript version (if applicable)
4.8.0
Description
mongoose.set('strictQuery', false);
only correctly disables strict query behavior if you run it before the schemas are created. After the schemas are created, changes to this property is ignored. Similarly, if you change it in the middle of schema creation, it affects some schemas but not others. The schemas should respect the current state of this global if it's set, not what it was at schema creation time.Steps to Reproduce
Expected Behavior
The current state of
mongoose.set('strictQuery', false);
should be used if no per-query/schema overrides are specified.The text was updated successfully, but these errors were encountered: