MongoDB CRUD Operation Delete


Example

Deletes all documents matching the query parameter:

// New in MongoDB 3.2
db.people.deleteMany({name: 'Tom'})

// All versions
db.people.remove({name: 'Tom'})

Or just one

// New in MongoDB 3.2
db.people.deleteOne({name: 'Tom'})

// All versions
db.people.remove({name: 'Tom'}, true)

MongoDB's remove() method. If you execute this command without any argument or without empty argument it will remove all documents from the collection.

db.people.remove();

or

db.people.remove({});