How do you rename a MongoDB database?

前端 未结 10 1540
难免孤独
难免孤独 2020-11-29 15:04

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\', \         


        
10条回答
  •  旧巷少年郎
    2020-11-29 15:10

    There is no mechanism to re-name databases. The currently accepted answer at time of writing is factually correct and offers some interesting background detail as to the excuse upstream, but offers no suggestions for replicating the behavior. Other answers point at copyDatabase, which is no longer an option as the functionality has been removed in 4.0. I've updated SERVER-701 with my notes and incredulity.

提交回复
热议问题