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
    • AI Helper
    • Team Sharing
    • Index Manager
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Blog
    • Community
    • Testimonials
    • Whitepapers
    • Reports
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Careers
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • Download
  • My 3T
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: 17/10/2022) 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
  • Test your skills: Importing and Exporting MongoDB Data
  • What’s New in Studio 3T 2021.3 | Data Masking on Exports and Our Darkest Theme Yet
  • 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
  • White Papers
  • Testimonials
  • Discounts

Company

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

© 2023 3T Software Labs Ltd. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum

We value your privacy

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 ("analytics and marketing") and to provide you with additional functions (“functional”). 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.

By clicking “Accept all”, you consent to the storage of cookies and the processing of personal data for these purposes, including any transfers to third countries. By clicking on “Decline all”, you do not give your consent and we will only store cookies that are necessary for our website. You can customize the cookies we store on your device or change your selection at any time - thus also revoking your consent with effect for the future - under “Manage Cookies”, or “Cookie Settings” at the bottom of the page. You can find further information in our Privacy Policy.
Accept all
Decline all
Manage cookies
✕

Privacy Preference Center

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 ("analytics and marketing") and to provide you with additional functions (“functional”). 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 our Privacy Policy.

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.

Google Analytics

Google Ads

Bing Ads

Facebook

LinkedIn

Quora

Hotjar

Reddit

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.

HubSpot

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
✕