I’ll introduce the procedure for changing database names in MongoDB.
First, MongoDB doesn’t have a way to atomically rename DB names, so the procedure is to copy and then delete the old DB.
Here are the MongoDB commands to change database names:
// Copy the database with the new name you want to change to
db.copyDatabase('old_name', 'new_name');
// Switch to the old database
use old_name
// Delete the old database
db.dropDatabase();
If the database is large, db.copyDatabase will take time, but there’s no choice but to wait patiently.
That’s all from the Gemba.