delete database mongodb code example
Example 1: drop mongo database
show dbs
use YOUR_DATABASE_NAME
db.dropDatabase()
show collections
Example 2: mongodb drop db
db.dropDatabase()
Example 3: drop mongodb database
db.dropDatabase()
Example 4: mongo remove all dbs
mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})'
Example 5: how to drop db in mongo shell
use DB_NAME
db.dropDatabase()
show dbs
Example 6: drop database mongodb command line
mongo <dbname> --eval "db.dropDatabase()"