On this page本页内容
db.copyDatabase(fromdb, todb, fromhost, username, password, mechanism)¶Deprecated since version 4.0.自版本4.0以来已弃用。
Important
Starting in version 4.2, MongoDB removes the 从4.2版开始,MongoDB删除copydb command. copydb命令。The deprecated 不推荐使用的db.copyDatabase(), which wraps the copydb command, can only be run against MongoDB 4.0 or earlier versions. db.copyDatabase()封装了copydb命令,只能在MongoDB 4.0或更早版本上运行。For behavior and examples, refer to the 4.0 or earlier version of the manual.有关行为和示例,请参阅4.0或更早版本的手册。
For an alternative in version 4.2+, see Copy/Clone a Database.有关版本4.2+中的替代方案,请参阅复制/克隆数据库。
Copies a database either from one 将数据库从一个mongod instance to the current mongod instance or within the current mongod.mongod实例复制到当前mongod实例或在当前mongod内。
The mongo shell method db.copyDatabase() takes the following arguments:mongo shell方法db.copyDatabase()采用以下参数:
fromdb |
string | |
todb |
string | |
fromhost |
string | mongod instance. mongod实例的主机名。mongod instance.mongod实例中的数据库。 |
username |
string |
|
password |
string |
|
mechanism |
string |
|