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 :

  1. first select the database which you want to delete

    use < database name >

  2. db.dropDatabase()

echo "db.dropDatabase()" | mongo <database name>


http://stackoverflow.com/questions/8857276/how-do-i-drop-a-mongodb-database-from-the-command-line
 
 

相关文章:

  • 2022-01-15
  • 2021-11-04
  • 2022-03-04
  • 2021-07-07
  • 2022-02-13
  • 2022-12-23
  • 2021-09-29
  • 2021-07-15
猜你喜欢
  • 2021-08-14
  • 2022-02-13
  • 2022-12-23
  • 2021-10-04
  • 2021-06-24
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案