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 进行身份验证。
|