Navigation

clone

On this page

clone

The clone command clones a database from a remote MongoDB instance to the current host. clone copies the database on the remote instance with the same name as the current database. The command takes the following form:

{ clone: <hostname:port>, bypassDocumentValidation: <boolean> }

clone has the following fields:

Field Type Description
hostname:port string The hostname and port of the remote MongoDB instance.
bypassDocumentValidation boolean

Optional. Enables clone to bypass document validation during the operation. This lets you insert documents that do not meet the validation requirements.

New in version 3.2.

Behavior

  • clone can copy from a non-primary member of a replica set.
  • clone does not snapshot the database. If any clients update the database you’re copying at any point during the clone operation, the resulting database may be inconsistent.
  • You must run clone on the destination server.
  • The destination database will be locked periodically during the clone operation. In other words, clone will occasionally yield to allow other operations on the database to complete.

See copydb for similar functionality with greater flexibility.

←   clean cloneCollection  →