There's a typo in my MongoDB database name and I'm looking to rename the database.
I can copy and delete like so…
db.copyDatabase('old_name', 'new_name');
use old_name
db.dropDatabase();
Is there a command to rename a database?
databasemongodb
There's a typo in my MongoDB database name and I'm looking to rename the database.
I can copy and delete like so…
db.copyDatabase('old_name', 'new_name');
use old_name
db.dropDatabase();
Is there a command to rename a database?
Best Answer
You could do this:
Editorial Note: this is the same approach used in the question itself but has proven useful to others regardless.