As of now, there is not a straight forward way to rename a MongoDB database. But you can use the following steps to achieve so :
Here, we are trying to rename OLD_DB to NEW_DBSteps :
1) copy old database to new one using db.CopyDatabase( OLD_DB, NEW_DB )
2) switching to OLD_DB and dropping the database
Mongo Command :
#Step 1 : Copy database to new name
db.copyDatabase("OLD_DB","NEW_DB")
#Step 2 and 3, drop OLD_DB
use OLD_DB
db.dropDatabase()
No comments :
Post a Comment
Your Comment and Question will help to make this blog better...