MongoDB Удалить все из коллекции
db.collection.remove({})
Weary Wombat
db.collection.remove({})
//To delete all documents
db.movies.deleteMany({})
//Delete All Documents that Match a Condition
db.movies.deleteMany( { title: "Titanic" } )
//Delete Only One Document that Matches a Condition
db.movies.deleteOne( { cast: "Brad Pitt" } )
to delete a document
db.games.deleteOne({name:"Snake"})
db.collection.delete_many( { } );
1 db.coll.remove({name: "Max"})
2 db.coll.remove({name: "Max"}, {justOne: true})
3 db.coll.remove({}) // WARNING! Deletes all the docs but not the collection itself and its index definitions
4 db.coll.remove({name: "Max"}, {"writeConcern": {"w": "majority", "wtimeout": 5000}})
5 db.coll.findOneAndDelete({"name": "Max"})
db.bios.remove( { } )