Knowledge base · Studio 3T Desktop IDE

How to Copy a MongoDB Collection to Another Database

By Thomas Zahn, Kirsty Burgess · Updated

Studio 3T’s built-in copy and paste collection feature is the fastest way to copy (or duplicate) an entire MongoDB collection to another database. The ability to copy collections is useful for migrating data, backing up data, setting up development or test environments, and creating subsets of data for security purposes.

If you’re looking to create subsets of data, check out our Export Wizard, where you can export a collection from MongoDB to another collection with the results from a find query or an aggregation query. With the Export Wizard, you can also mask sensitive data at field level if you’re concerned about data privacy.

Ready? Download the latest version of Studio 3T.

Copy MongoDB collection

In the Connection Tree, find the source collection you want to copy and right-click it. You can copy all the collections in a database by selecting the Collections node and right-clicking it.

Select Copy Collection(s).

To copy MongoDB collections, select the collections in the Connection Tree, right-click, and select Copy Collection(s)

Paste MongoDB collection

In the Connection Tree, select the target MongoDB database where you want to copy your source collection(s) and right-click it.

Select Paste Collection(s).

To paste MongoDB collections to another database or collection, select the database in the Connection Tree, right-click, and select Paste Collection(s)

Configure copy & paste

If you’re copying collections to existing target collections, in the Copy Collection dialog, you can choose to:

  • Append to the existing collection and then choose how the copy operation treats the document _ids
  • Replace the collection
  • Create a collection with a new name

You also have the option to include or exclude the indexes on the collections and if it exists, copy the schema validator. To learn more about how MongoDB applies schema validation, see the MongoDB documentation.

Take advantage of other handy copy/paste features in Studio 3T:

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes, including personalized advertising (“performance”), to provide you with additional functions (“functional”), and to show content from social media platforms, such as embedded videos (“social media”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data. Please choose for which purposes you wish to give us your consent and store your preferences by clicking on “Accept selected”. You can find further information in section 9 of our Privacy Policy.

Manage consent preferences