db.cloneDatabase()

On this page本页内容

Definition定义

db.cloneDatabase("hostname")

Deprecated since version 4.0.自版本4.0以来已弃用

Important重要

Starting in version 4.2, MongoDB removes the clone command. 从4.2版开始,MongoDB删除clone命令。The deprecated db.cloneDatabase(), which wraps the clone command, can only be run against MongoDB 4.0 or earlier versions. 包装克隆命令的不推荐使用的db.cloneDatabase()只能在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 remote database to the current database. 将远程数据库复制到当前数据库。The command assumes that the remote database has the same name as the current database.该命令假定远程数据库与当前数据库同名。

Parameter参数Type类型Description描述
hostnamestringThe hostname of the database to copy.要复制的数据库的主机名。
←  db.aggregate()db.commandHelp() →