This repository was archived by the owner on May 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
DOCSP-46301-clean-verify-data #617
Merged
gmiller-mdb
merged 7 commits into
mongodb:master
from
gmiller-mdb:DOCSP-46301-clean-verify-data
Mar 3, 2025
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a0ed6d7
DOCSP-46301-clean-verify-data
gmiller-mdb ce5fcc5
move code
gmiller-mdb bda591f
fix indent errors
gmiller-mdb 1a37608
changing table
gmiller-mdb 15a0a68
fix links
gmiller-mdb dd9d3bb
feedback
gmiller-mdb 9ba6958
build errors
gmiller-mdb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
.. _c2c-custom-manual-verification: | ||
|
||
================================== | ||
Verifying Data with Custom Scripts | ||
================================== | ||
|
||
.. default-domain:: mongodb | ||
|
||
.. facet:: | ||
:name: genre | ||
:values: tutorial | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 1 | ||
:class: singlecol | ||
|
||
nvillahermosa-mdb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
You can write a script to query your source cluster and compare the documents, | ||
indexes, collections, metadata, and views with the destination cluster. | ||
|
||
.. _c2c-document-comparison: | ||
|
||
Comparing Documents | ||
------------------- | ||
|
||
You can verify sync by comparing documents on the source and destination clusters. | ||
|
||
Before you can verify data transfer with this method, ``mongosync`` must be in | ||
the ``COMMITTED`` state. | ||
|
||
.. _c2c-index-comparison: | ||
|
||
Comparing Indexes | ||
----------------- | ||
|
||
To verify the transfer of indexes, run :method:`db.collection.getIndexes` | ||
on the source and destination clusters and compare the results. | ||
|
||
.. _c2c-metadata-comparison: | ||
|
||
Comparing Metadata | ||
------------------ | ||
|
||
To verify the transfer of metadata, run :method:`db.getCollectionInfos` | ||
on the source and destination clusters and compare the results. | ||
|
||
.. _c2c-shardkey-comparison: | ||
|
||
Comparing Shard Keys | ||
-------------------- | ||
|
||
To verify the transfer of shard keys to a synced collection, run a query on the | ||
``config.collections`` collection to find a document whose ``_id`` value is the | ||
namespace of the target collection. Compare the ``key`` value of this document | ||
in the source and destination clusters. | ||
|
||
For example, for a collection named ``pets`` in the ``records`` database, you | ||
can verify the shard key using the following query in :binary:`mongosh`: | ||
|
||
.. io-code-block:: | ||
:copyable: true | ||
|
||
.. input:: | ||
:language: javascript | ||
|
||
db.getSiblingDB("config").collections.find({ _id : "records.pets" }) | ||
|
||
.. output:: | ||
:language: javascript | ||
:emphasize-lines: 5-7 | ||
:visible: false | ||
|
||
{ | ||
"_id" : "records.pets", | ||
"lastmod" : ISODate("2021-07-21T15:48:15.193Z"), | ||
"timestamp": Timestamp(1626882495, 1), | ||
"key" : { | ||
"_id" : 1 | ||
}, | ||
"unique" : false, | ||
"lastmodEpoch" : ObjectId("5078407bd58b175c5c225fdc"), | ||
"uuid" : UUID("f8669e52-5c1b-4ea2-bbdc-a00189b341da") | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.