How to rename a database in MongoDB

In this article, we will see how to rename a database in MongoDB. Until MongoDB 4. or below versions, we can rename database by using db.copyDatabase(). But later versions of 4.0, it is not possible to rename a database using copyDatabase() method. The only solution is dump and restore the database.

Steps to rename a database in MongoDB:

1. Take dump of existing database. These commands has to be run from Unix level.
Continue reading How to rename a database in MongoDB