Deleting
suggest changeDeleting documents from a Mongoose model is done as follows. Query#remove() was removed in Mongoose 7. Use deleteMany (or deleteOne for a single match). This assumes the Auto model from the collection example.
Auto.deleteMany({ _id: 123 }).then(function (result) {
console.log(result);
}).catch(function (err) {
console.error(err);
});
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents