How to copy and paste a MongoDB collection across databases and servers

MongoChef makes copying MongoDB collections across 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.

MongoChef Copy MongoDB Collection

2. Paste MongoDB Collection

Select your target 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.

MongoChef Paste MongDB Collection

3. Configure Copy & Paste of MongoDB Collections

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.

MongoChef Paste MongoDB Collection

4. That’s it! Your MongoDB collection has been copied!

BTW: in the bottom left corner, you can always monitor the progress of your copy operation, and in case of very long-running operations, also cancel them.

MongoChef View Copied MongoDB Collection

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *