In this short tutorial, we’ll show you how (ridiculously) easy it is to copy a MongoDB collection to another database using Studio 3T.
Download our MongoDB GUI now, and let’s roll.
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.
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.
3. Configure Copy & Paste
In the Paste Collection dialog, you can choose how the copy operation 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 with the same name, the source collection will be inserted with the prefix “Copy_of_”.
To finish, click Paste Collection. This will copy your source collection to your target.
4. That’s It!
And just like that, your MongoDB collection is copied to another database and/or server 🙂
As a pro tip, you can always monitor your copy job on the bottom-left corner and cancel any long-running operations.
Now that you’ve learned how simple it is to copy and paste MongoDB collections in Studio 3T, try it out for yourself, in case you haven’t downloaded our MongoDB GUI yet.
You’ll easily discover it’s not just copying collections that we’ve made easy. Read up on these tutorials to save even more time:
- How to copy and paste MongoDB documents
- How to import and export MongoDB data
- How to add and modify MongoDB indexes
Editor’s Note: This post was originally published in February 2015.