In documentation there's deleteMany() method
Character.deleteMany({ name: /Stark/, age: { $gte: 18 } }, function (err) {});
I want to remove multiple documents that have one common property and the other property vary. Something like this:
Site.deleteMany({ userUID: uid, id: [10, 2, 3, 5]}, function(err)
{}
What would be the proper syntax for this?
I believe what youre looking for is the $in
operator:
Site.deleteMany({ userUID: uid, id: { $in: [10, 2, 3, 5]}}, function(err) {})
Documentation here: https://docs.mongodb.com/manual/reference/operator/query/in/