mongo <dbname> --eval "db.dropDatabase()"
> use mydb; > db.dropDatabase();
mongo localhost/db <<EOF
db.dropDatabase()
EOF
Results in output like:
mongo localhost/db <<EOF
db.dropDatabase()
EOF
MongoDB shell version: 2.2.2
connecting to: localhost/db
{ "dropped" : "db", "ok" : 1 }
bye
command for Database drop is :
-
first select the database which you want to delete
use < database name >
-
db.dropDatabase()
echo "db.dropDatabase()" | mongo <database name>
http://stackoverflow.com/questions/8857276/how-do-i-drop-a-mongodb-database-from-the-command-line