摘要:MongoDB 刪除及修改database name
rename
use database_name
db.copyDatabase('database_name','database_name2');
db.dropDatabase()
網路上還有提供另一個解
http://docs.mongomachine.com/renaming-databases
使用四招
解決了這樣的問題
use new_database
mongodump -h [server_uri]:[server_port] -d [the_old_db] -u [username] -p [password] -o ~/tmp/db_backup
mongorestore -h [server_uri]:[server_port] -d [mysite_production] -u [username] -p [password] ~/tmp/db_backup/[the_old_db]
use old_database_name
db.dropDatabase()