mongodb delete database code example
Example 1: 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
Example 2: delete database mysql
DROP DATABASE dbname;
Example 3: mongodb drop db
db.dropDatabase()
Example 4: drop mongodb database
db.dropDatabase()
Example 5: how to drop db in mongo shell
use DB_NAME // go to the db you want to delete
db.dropDatabase()
show dbs
// droppped db will not be shown
Example 6: drop database mongodb command line
mongo <dbname> --eval "db.dropDatabase()"