Very-very wrong behavior of mongoose version 6 function deleteMany

Welcome to the MongoDB community @Vadim_Shumilin !

I suspect this is another consequence of Mongoose 6 changing the strictQuery behaviour so query filter properties that are not in the schema will now be filtered out by default :scream:.

This is unexpected behaviour that is inconsistent with the official MongoDB Node.js driver behaviour (related discussion: How to avoid accidentally returning an arbitrary document when using findOne with a non-existing field in Mongoose? - #7 by Stennie).

Mongoose is an open source community project, so the best channel to search or create Mongoose bug reports is the GitHub issue queue: Issues · Automattic/mongoose · GitHub.

I see you have already created Mongoose #12389 for this deleteMany() issue. I think a key upstream issue to watch/upvote is Mongoose #11861: Make strictQuery false by default again.

Regards,
Stennie

1 Like