Studio 3T (formerly MongoChef) makes copying a collection across MongoDB databases and servers a breeze – you literally just copy and paste your collection!
1. Copy MongoDB Collection
Select the source collection you want to copy and right-click it in the connection tree. In our case, this is collection test.people on localhost.
Choose “Copy Collection” from the context menu. This will mark the collection for copying.
2. Paste MongoDB Collection
Select your target MongoDB database (or collection) that you want to copy your source collection to. In our example, that is database “test” on server “ADX”.
Right-click your target and choose “Paste Collection” from the context menu.
3. Configure Copy & Paste
In the Paste Collection dialog you can choose how the copying should treat (existing) document _ids (note that this usually only relevant when you decide to copy a collection into another, existing target collection).
If you paste a collection into a target database that already contains a collection by the same name, the source collection will be inserted with the prefix “Copy_of_”.
To finish, click “Paste Collection”, and your source collection will be copied to your target.
4. Your MongoDB Collection Has Been Copied to Another Database!
Tip: You can always monitor the progress of your copy operation in the bottom left corner. In case of very long-running operations, you can also cancel them.
Complement this tutorial with our short guide on how to sort collection views and how to handle special characters in collections. With our latest release Studio 5.4.0, we’ve also made copying MongoDB database and collection names even simpler – find out how here.
Editor’s Note: This post was originally published in February 2015 and has been updated for accuracy.