Answers for "how to delte db on local mongo"

Go
25

drop mongo database

// First show what databases have you gotten 
show dbs
// then, use the database name that you want to drop
use YOUR_DATABASE_NAME
// now you can drop it
db.dropDatabase()
// show collections should be empty now
show collections
Posted by: Guest on June-05-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

Browse Popular Code Answers by Language