jayjayswal
10/7/2019 - 9:41 AM

Cheat Code - delete

// The remove() Method
// MongoDB's remove() method is used to remove a document from the collection. 
// remove() method accepts two parameters. One is deletion criteria and second is justOne flag.
// deletion criteria − (Optional) deletion criteria according to documents will be removed.
// justOne − (Optional) if set to true or 1, then remove only one document.
db.COLLECTION_NAME.remove(DELLETION_CRITTERIA)

//e.g.
db.mycol.remove({'title':'MongoDB Overview'})
db.COLLECTION_NAME.remove({'title':'MongoDB Overview'},1)

// remove all docs
db.mycol.remove({})