Docs Menu

Docs HomeMongoDB Manual

db.cloneDatabase()

On this page

  • 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 clone command, can only be run against MongoDB 4.0 or earlier versions. For behavior and examples, refer to the 4.0 or earlier version of the manual.

For an alternative in version 4.2+, see Copy and Clone Databases.

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
hostname
string
The hostname of the database to copy.
←  db.aggregate()db.commandHelp() →

On this page

Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.