Docs Menu
Docs Home
/
MongoDB Cluster-to-Cluster Sync
/ /

Verify with Document Counts

On this page

  • Steps
  • Learn More

The most basic method of verification is to compare the number of documents in each synced collection on the source cluster to the number on the destination cluster.

This method only verifies a successful sync when run against clusters with insert-only workloads. If you do not have an insert-only workload for the cluster, use a different verification method.

1

Run the countDocuments() method on each synced collection on the source cluster:

db.us_accounts.countDocuments()
345

Note the number of documents.

2

Run the countDocuments() method on each synced collection on the destination cluster:

db.us_accounts.countDocuments()
345

Note the number of documents.

3

Compare the results of each document count:

  • If the document count is different, not all changes synced to the destination cluster.

  • If the document count is the same and your cluster has an insert-only workload, the sync was successful.

  • If your source cluster does not have an insert-only workload, use a different method to verify sync.

Back

Use Embedded Verifier

On this page