Try Studio 3T for Free
  1. Knowledge Base
  2. MongoDB Tutorials
  3. Managing MongoDB Collections & Documents
  4. How to Copy and Paste MongoDB Documents Across Databases and Collections

How to Copy and Paste MongoDB Documents Across Databases and Collections

In Studio 3T, you can reliably (and easily) copy MongoDB documents and paste them across databases and collections.

Download our MongoDB GUI, and let’s get started.

1. Open your source MongoDB collection in Studio 3T and select the documents that you would like to copy – either by selecting the documents themselves or any of their fields.

2. Right-click and choose “Copy Selected Documents To Clipboard” from the popup menu – or use the keyboard short-cut Ctrl+C or Shift+Cmd+C. (Note that just Cmd+C would copy the selected individual fields rather than the entire documents)

Highlight the documents you wish to import

3. Next, open your MongoDB target collection.

4. Right-click anywhere and select “Paste Documents” (or simply press Ctrl+V or Cmd+V), and the documents are copied into the target collection. Easy as that.

And voilà:

And the best is: Copy & paste in Studio 3T is 100% reliable and lossless! All types (including complex ones such as Code-with-Scope, Timestamp, or fine-grained ones such as Int32, Int64) are supported and preserved.

Studio 3T also pastes documents with their original _id. By default, if a duplicate document already exists, the to-be-pasted document will be inserted with a new ObjectId in its _id field.

If you need more fine-grained control over how duplicate documents should be handled, you can do so via the import dialog.

Don’t forget to check out our What’s New section for other helpful tips on how to update field values, modify MongoDB indexes, and more. If you haven’t downloaded our MongoDB GUI yet, here you go. Happy copy & pasting!

Updated on May 24, 2019

Was this article helpful?

Related Articles

Leave a Comment