Skip to content
Studio 3T - The professional GUI, IDE and client for MongoDB
  • Tools
    • Aggregation Editor
    • IntelliShell
    • Visual Query Builder
    • Export Wizard
    • Import Wizard
    • Query Code
    • SQL Query
    • Connect
    • Schema Explorer
    • Compare
    • SQL ⇔ MongoDB Migration
    • Data Masking
    • Task Scheduler
    • Reschema
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Reports
    • Case Studies
    • Whitepapers
    • Blog
    • Testimonials
    • Community
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Career
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • My License
  • Download
search

Studio 3T Knowledge Base

  • Documentation
  • Tutorials
  • Workshops
Take the fastest route to learning MongoDB. Cover the basics in two hours with MongoDB 101, no registration required.
Start the free course

Data Compare and Sync

Posted on: 04/12/2020 (last updated: 05/11/2021) by Kathryn Vargas
tl;dr
Shortcuts

Data Compare and Sync shows the differences between any two MongoDB collections side-by-side for an easier, more visual data comparison. Users can then analyze and sync data, and export results as needed. Download it here.

When clicking on a source document/field:
Copy document/field to target – Ctrl + I (⌘+ I)
Copy document/field from target – Ctrl + U  (⌘+ U)

When clicking on a target document/field:
Copy document/field from source – Ctrl + I (⌘+ I)
Copy document/field to source – Ctrl + U  (⌘+ U)

Refresh all (documents) – Ctrl + R (⌘+ R)
Refresh differences – Shift + Ctrl + R (Shift + ⌘+ R)
Delete document – Shift + Del  (Shift + Fn + Del)
Add field/value – Ctrl + K (⌘+ K)
Remove field – Del (Fn + Del)
Rename field – Shift + F2
Copy value as text – Ctrl + C (Shift + C)
Copy value – Alt + Shift + C (⌥ + Shift + C)
Copy field to clipboard – Alt + Ctrl + C (⌥ + ⌘+ C)

Basics

Data Compare and Sync simplifies data comparison between two MongoDB collections across databases and/or servers.

To open Data Compare and Sync:

  • Right-click on any collection and database in the Connection Tree and choose Compare To…
  • Click on the Compare button in the global toolbar

Choose source and target connections

The documents from the source connection will be compared to documents from the target connection.

Compare data with the Data Compare and Sync function.
  1. Under Source Connection, click Connect to server.
  2. The Connection Manager will open up. Create a new connection if needed; otherwise, select the existing connection.
  3. Similarly under Target Connection, click Connect to server and choose the connection.

In this tutorial, we’ll be comparing the source connection test-db located in the localhost server, against the target connection test-db located in the Studio 3T Replica Set server.

Choose collections to compare

  1. Drag the source database on top of the target database.
    This will compare all collections in the source database against those in the target database.
  2. Alternatively, drag only the source collection(s) on top of the target collection(s).

Remove collections from comparison

  • Right-click on the pair and choose Remove from comparison list
  • Click on the Remove button to the right of the table

Configure the data comparison

Data Compare and Sync’s configuration settings allow for a narrower comparison based on criteria like fields, number of documents, and more.

Click on the Configure button to the right of the table. This will open up the Comparison Configuration window which has four tabs: Match On, Compare, Filter, and Projection.

Match On

Under the Match On tab, configure the comparison to match on a selected field or fields, instead of the default setting _id.

Just remember to choose fields 1.) that have unique values and 2.) whose collections have an index.

Compare

Under the Compare tab:

  • Define how many documents should be read per batch for comparison. By default this is set to 1,000 documents.
  • Choose whether to treat number types (e.g. Int32, Int64) as equal or not
  • Specify which fields to compare and which fields to ignore. By default, all fields are compared.

Filter

Under the Filter tab, enter a filter criteria to limit the set of documents to compare.

Projection

Under the Projection tab, set the numeric limit of fields to compare.

Run and analyze the comparison

To run the comparison:

  1. Click on the Run comparison button above the table.
  2. When the run is completed, a comparison will open for each pair of collections, each with three tabs: Overview, Differences, and Multiple Matches.

Overview

The Overview shows exactly what was compared and provides a permanent record of the comparison.

It displays helpful statistics like comparison duration, number of documents analyzed, number of identical and differing documents, and more.

Differences

The Differences tab visualizes the differences between the two collections.

  • Differing documents and fields are highlighted in yellow
  • Source-only documents and fields are highlighted in green
  • Target-only documents and fields are highlighted in red
  • Identical documents and fields are shown in the normal alternating grey and white lines, or whichever colors are normal for the OS in use

The same highlighting pattern can be found among fields when documents are expanded.

To expand or collapse all documents, right-click anywhere in the Differences tab and choose Expand All or Collapse All.

Click on View Options to group differences by type, or to show only the differing fields.

Multiple Matches

The Multiple Matches tab shows the overview of documents which match on selected fields, instead of the default _id.

Read the Configure the data comparison chapter for more information on how to match documents on selected fields.

For example, let’s match on the field first.

The Multiple Matches tab shows how many source and target documents contain any given unique value of the selected field (first).

In the screenshot above, 7 source documents and 7 target documents were found to have the name value “Kenneth”.

To view the source and target documents, click on Show Documents. This will open up the Multiple Match – Differences window.

The same color scheme in the Differences tab is used in the Multiple Matches – Differences window to highlight differences in source and target fields, and identical records.

Sync documents and fields

Syncing data between source and target databases can be done in a right-click or hotkey from the Differences and Multiple Matches tabs.

Documents

To copy documents to the target collection:

  • Right-click – Right-click on any source document and choose Copy Document to Target, or Right-click on any target document and choose Copy Document from Source
  • Hotkey – Ctrl + I (⌘+ I) – Copy document to target (when clicking on a source document, or Ctrl + I  (⌘+ I) – Copy document from source (when clicking on a target document)

To copy documents to the source collection:

  • Right-click – Right-click on any target document and choose Copy Document to Source, or right-click on any source document and choose Copy Document from Target
  • Hotkey – Ctrl + U (⌘+ U) – Copy document from target (when clicking on a source document, or Ctrl + U  (⌘+ U) – Copy document to source (when clicking on a target document)

Fields

Data Compare and Sync lets you do a bi-directional sync of fields on the same document, in that some changes are copied from the target document to the source, and other changes from the source to the target.

Go to View Options > Show Differing Fields to show only differing fields.

To copy fields to the target collection:

  • Right-click – Right-click on any source field and choose Copy Field to Target, or
    Right-click on any target field and choose Copy Field from Source
  • Hotkey – Ctrl + I (⌘+ I) – Copy field to target (when clicking on a source document) or Ctrl + I  (⌘+ I) – Copy field from source (when clicking on a target document)

To copy documents to the source collection:

  • Right-click – Right-click on any target field and choose Copy Field to Source, or
    right-click on any source field and choose Copy Field from Target
  • Hotkey – Ctrl + U (⌘+ U) – Copy field from target (when clicking on a source document) or Ctrl + U  (⌘+ U) – Copy field to source (when clicking on a target document)

Edit data in-place

For small changes, there’s no need to invoke the right-click menu. Simply double-click a field and edit it directly – the diff status is updated in real time.

Export comparison results

To export comparison results to a CSV file, click on the Export button under the Differences tab.


How helpful was this article?
This article was hideous
This article was bad
This article was ok
This article was good
This article was great
Thank you for your feedback!

About The Author

Kathryn Vargas

When she's not writing about working with MongoDB, Kathryn spends her free time exploring Berlin's food scene, playing the drums, learning languages (current mission: German), and hiking.

Article navigation

Related articles

  • Compare Page
  • Working with MongoDB Data? Use These Data Masking Techniques
  • Getting Data Masking and Anonymization Right
  • Test your skills: Importing and Exporting MongoDB Data
  • What’s New in Studio 3T 2021.5 | Streamlining UX and a new Data Masking technique

Studio 3T

MongoDB Enterprise Certified Technology PartnerSince 2014, 3T has been helping thousands of MongoDB developers and administrators with their everyday jobs by providing the finest MongoDB tools on the market. We guarantee the best compatibility with current and legacy releases of MongoDB, continue to deliver new features with every new software release, and provide high quality support.

Find us on FacebookFind us on TwitterFind us on YouTubeFind us on LinkedIn

Education

  • Free MongoDB Tutorials
  • Connect to MongoDB
  • Connect to MongoDB Atlas
  • Import Data to MongoDB
  • Export MongoDB Data
  • Build Aggregation Queries
  • Query MongoDB with SQL
  • Migrate from SQL to MongoDB

Resources

  • Feedback and Support
  • Sales Support
  • Knowledge Base
  • FAQ
  • Reports
  • Case Studies
  • White Papers
  • Testimonials
  • Discounts

Company

  • About Us
  • Blog
  • Careers
  • Legal
  • Press
  • Privacy Policy
  • EULA

© 2022 3T Software Labs GmbH. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum
When you click "Accept", you are agreeing to cookies being on your device. They may improve site navigation, site usage analysis, or the relevance of messages. It is up to you which cookies are enabled. Read our Privacy Policy.
Manage cookies
Accept
✕

Privacy Preference Center

A cookie is a small file of letters and numbers that is downloaded on to your computer when you visit a website. Cookies are used by many websites and can do a number of things, eg remembering your preferences, recording what you have put in your shopping basket, and counting the number of people looking at a website. In the form below you can choose which cookies, except for essential cookies, to allow or disable.

Accept all cookies

Manage consent preferences

Essential cookies are strictly necessary to provide an online service such as our website or a service on our website which you have requested. The website or service will not work without them.

Performance cookies allow us to collect information such as number of visits and sources of traffic. This information is used in aggregate form to help us understand how our websites are being used, allowing us to improve both our website’s performance and your experience.

Functional cookies collect information about your preferences and choices and make using the website a lot easier and more relevant. Without these cookies, some of the site functionality may not work as intended.

Social media cookies are cookies used to share user behaviour information with a third-party social media platform. They may consequently effect how social media sites present you with information in the future.

Accept selected