Deleting

suggest change

Deleting 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);
});

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents