DeprecationWarning: Mongoose: the `strictQuery`

hi
i am reciving thiss error while i try to connect to mongo db using mongoose

Blockquote
(node:20404) [MONGOOSE] DeprecationWarning: Mongoose: the strictQuery option will be switched back to false by default in Mongoose 7. Use mongoose.set('strictQuery', false); if you want to prepare for this change. Or use mongoose.set('strictQuery', true); to suppress this warning.

i need to know what are the strictQuery and why i am getting this error

Hello @mina_remon ,

Welcome to The MongoDB Community Forums! :wave:

Schemas have a few configurable options which can be passed to the constructor or to the set method:

new Schema({..}, options);

// or

const schema = new Schema({..});
schema.set(option, value);

When strict option is set to true , Mongoose will ensure that only the fields that are specified in your Schema will be saved in the database, and all other fields will not be saved (if some other fields are sent). In simple term, the strict option, ensures that values passed to our model constructor that were not specified in our schema do not get saved to the db. Mongoose supports a separate strictQuery option to avoid strict mode for query filters. This is because empty query filters cause Mongoose to return all documents in the model, which can cause issues.

To learn more about these options, please go through Mongoose v6.8.4: Schemas.

Regards,
Tarun