Answers for "how to delete all the items of a db in mongo"

5

mongodb delete all documents

db.collection.delete_many( { } );
Posted by: Guest on April-20-2020
0

mongo remove all dbs

mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})'
Posted by: Guest on September-14-2020

Code answers related to "how to delete all the items of a db in mongo"

Browse Popular Code Answers by Language