Skip to content
Monghoul

Copy a collection to another cluster

Move a collection between two connections, and what write protection does when the target is production.

Needs Pro, or the 14-day trial Checked against v1.11.0 Updated
The Copy Collection dialog copying Production / shop / orders into Staging / shop / orders, with a write mode of insert and a copy-indexes option
Copy · Production to Staging, with a write mode and the indexes, and no file in between Pro

Copying between instances is a Pro feature and it goes directly, without you exporting to a file and importing it back.

Copy one collection

Copying lives inside the export flow, which is the part people do not guess.

  1. Right-click the source collection and choose Export.
  2. In the export dialog, choose another MongoDB collection as the destination rather than a file.
  3. Pick the target connection and database, and confirm.

You can also drag a collection or a database onto a destination in the tree, which opens the same dialog with that destination already chosen. Only a destination the copy could actually use lights up: another connection, or another database on the same one.

Duplicating a database

A database export can write into another database rather than to a directory, which duplicates it one collection at a time. Indexes can be carried across with it.

What write protection does here

If the target connection, database or collection is write protected, the copy asks for the same confirmation any other destructive operation asks for. It is not a special case and it does not get skipped because the write came from a copy rather than from the editor.

That matters because the direction is easy to get backwards, and the confirmation names the target. Read it.

When to use export and import instead

  • The two clusters cannot both be reached from your machine at the same time.
  • You want the intermediate file, for a backup or for a colleague.
  • You need to transform the documents on the way through.

For those, export to a file and import it on the other side. Use Extended JSON, not CSV, or the types will not survive.

Next