You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*[`strictQuery` is removed and replaced by `strict`](#strictquery-is-removed-and-replaced-by-strict)
14
+
*[`strictQuery` is now equal to `strict` by default](#strictquery-is-removed-and-replaced-by-strict)
15
15
*[MongoError is now MongoServerError](#mongoerror-is-now-mongoservererror)
16
16
*[Clone Discriminator Schemas By Default](#clone-discriminator-schemas-by-default)
17
17
*[Schema Defined Document Key Order](#schema-defined-document-key-order)
@@ -113,9 +113,12 @@ await q;
113
113
awaitq.clone(); // Can `clone()` the query to allow executing the query again
114
114
```
115
115
116
-
<h3id="strictquery-is-removed-and-replaced-by-strict"><ahref="#strictquery-is-removed-and-replaced-by-strict">`strictQuery` is removed and replaced by `strict`</a></h3>
116
+
<h3id="strictquery-is-removed-and-replaced-by-strict"><ahref="#strictquery-is-removed-and-replaced-by-strict">`strictQuery` is now equal to `strict` by default</a></h3>
117
117
118
-
Mongoose no longer supports a `strictQuery` option. You must now use `strict`. This means that, by default, Mongoose will filter out filter properties that are not in the schema.
118
+
~Mongoose no longer supports a `strictQuery` option. You must now use `strict`.~
119
+
As of Mongoose 6.0.10, we brought back the `strictQuery` option.
120
+
However, `strictQuery` is tied to `strict` by default.
121
+
This means that, by default, Mongoose will filter out query filter properties that are not in the schema.
119
122
120
123
```javascript
121
124
constuserSchema=newSchema({ name:String });
@@ -124,10 +127,16 @@ const User = mongoose.model('User', userSchema);
124
127
// By default, this is equivalent to `User.find()` because Mongoose filters out `notInSchema`
125
128
awaitUser.find({ notInSchema:1 });
126
129
127
-
// Set `strict: false` to opt in to filtering by properties that aren't in the schema
0 commit comments