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)
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.
- Under Source Connection, click Connect to server.
- The Connection Manager will open up. Create a new connection if needed; otherwise, select the existing connection.
- 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
- 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.
- 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.
Under the Match On tab, configure the comparison to match on a selected field or fields, instead of the default setting
Just remember to choose fields 1.) that have unique values and 2.) whose collections have an index.
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.
Under the Filter tab, enter a filter criteria to limit the set of documents to compare.
Under the Projection tab, set the numeric limit of fields to compare.
Run and analyze the comparison
To run the comparison:
- Click on the Run comparison button above the table.
- When the run is completed, a comparison will open for each pair of collections, each with three tabs: Overview, Differences, and Multiple Matches.
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.
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.
Click on View Options to group differences by type, or to show only the differing fields.
The Multiple Matches tab shows the overview of documents which match on selected fields, instead of the default
For example, let’s match on the field
The Multiple Matches tab shows how many source and target documents contain any given unique value of the selected field (
In the screenshot above, 8 source documents and 8 target documents were found to have the name value “Phyllis”.
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.
To copy documents to the target collection:
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
Ctrl + I (⌘+ I) – Copy document to target (when clicking on a source document)
Ctrl + I (⌘+ I) – Copy document from source (when clicking on a target document)
To copy documents to the source collection:
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
Ctrl + U (⌘+ U) – Copy document from target (when clicking on a source document)
Ctrl + U (⌘+ U) – Copy document to source (when clicking on a target document)
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.
To copy fields to the target collection:
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
Ctrl + I (⌘+ I) – Copy field to target (when clicking on a source document)
Ctrl + I (⌘+ I) – Copy field from source (when clicking on a target document)
To copy documents to the source collection:
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
Ctrl + U (⌘+ U) – Copy field from target (when clicking on a source document)
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.