db.cloneDatabase()

Definition

  • db.cloneDatabase("hostname")

Deprecated since version 4.0.

Important

Starting in version 4.2, MongoDB removes the clone command.The deprecated db.cloneDatabase(), which wraps the clonecommand, can only be run against MongoDB 4.0 or earlier versions.For behavior and examples, refer to the 4.0 or earlier version ofthe manual.

For an alternative in version 4.2+, seeCopy/Clone a Database.

Copies a remote database to the current database. The command assumesthat the remote database has the same name as the current database.

ParameterTypeDescriptionhostnamestringThe hostname of the database to copy.