On this page本页内容
db.copyDatabase(fromdb, todb, fromhost, username, password, mechanism)
Deprecated since version 4.0.
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或当前mongo内。
The mongosh helper method db.copyDatabase() takes the following arguments:mongosh helper方法db.copyDatabase()接受以下参数:
fromdb | string | |
todb | string | |
fromhost | string | mongod instance. mongod实例的主机名。mongod instance.mongod实例中的数据库。
|
username | string |
|
password | string |
|
mechanism | string |
db.copyDatabase()MONGODB-CR to authenticate to the fromhost.MONGODB-CR对fromhost进行身份验证。
|