How to delete multiple ids in mongodb?
You can accomplish this by using the command deleteMany.
const objects = [
ObjectId("51ee3966e4b056fe8f074f48"),
ObjectId("51ee3966e4b056fe8f074f4a"),
ObjectId("51ee3966e4b056fe8f074f4b")
];
db.collection.deleteMany({_id: { $in: objects}});
By running remove once for each ID, or perhaps using in:
db.collection.remove( { _id : { $in: [
ObjectId("51ee3966e4b056fe8f074f48"),
ObjectId("51ee3966e4b056fe8f074f4a"),
ObjectId("51ee3966e4b056fe8f074f4b")
] } } );