Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit a0ed6d7

Browse files
committed
DOCSP-46301-clean-verify-data
1 parent 6149617 commit a0ed6d7

File tree

2 files changed

+89
-60
lines changed

2 files changed

+89
-60
lines changed

source/reference/verification.txt

Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -92,66 +92,8 @@ source to the destination cluster.
9292
and replica sets that use MongoDB 4.4 or earlier
9393
releases, since the document field order can vary.
9494

95-
* - Document Comparison
96-
- You can verify sync by comparing documents on the source
97-
and destination clusters.
98-
99-
Write a script that queries collections on the source
100-
cluster and then checks that the correct documents,
101-
indexes, collections, metadata, and views exist with the
102-
same values on the destination cluster.
103-
104-
Before you can verify data transfer with this method,
105-
``mongosync`` must be in the ``COMMITTED`` state.
106-
107-
* - .. _c2c-index-comparison:
108-
109-
Index Comparison
110-
- To verify the transfer of indexes, run the
111-
:method:`db.collection.getIndexes` method on the source
112-
and destination clusters and compare the results.
113-
114-
* - .. _c2c-metadata-comparison:
115-
116-
Metadata Comparison
117-
- To verify the transfer of metadata, run the
118-
:method:`db.getCollectionInfos` method on the source and
119-
destination clusters and compare the results.
120-
121-
* - .. _c2c-shardkey-comparison:
122-
123-
Shard Key Comparison
124-
- To verify the transfer of shard keys to a synced collection, run a query on the ``config.collections``
125-
collection to find a document whose ``_id`` value is the namespace of the target collection.
126-
Compare the ``key`` value of this document in the source and destination clusters.
127-
128-
For example, for a collection named ``pets`` in the ``records`` database, you can verify the shard key
129-
using the following query in :binary:`mongosh`:
130-
131-
.. io-code-block::
132-
:copyable: true
133-
134-
.. input::
135-
:language: javascript
136-
137-
db.getSiblingDB("config").collections.find({ _id : "records.pets" })
138-
139-
.. output::
140-
:language: javascript
141-
:emphasize-lines: 5-7
142-
:visible: false
143-
144-
{
145-
"_id" : "records.pets",
146-
"lastmod" : ISODate("2021-07-21T15:48:15.193Z"),
147-
"timestamp": Timestamp(1626882495, 1),
148-
"key" : {
149-
"_id" : 1
150-
},
151-
"unique" : false,
152-
"lastmodEpoch" : ObjectId("5078407bd58b175c5c225fdc"),
153-
"uuid" : UUID("f8669e52-5c1b-4ea2-bbdc-a00189b341da")
154-
}
95+
* - :ref:`Custom or Manual Verification <c2c-custom-manual-verification>`
96+
- Different types of data require different methods of verification.
15597

15698
* - :ref:`Migration Verifier <c2c-migration-verifier>`
15799
- Migration Verifier connects to the source and destination
@@ -169,6 +111,7 @@ application workload and the complexity of the data.
169111
Use Document Counts </reference/verification/count>
170112
Use Hash Comparison </reference/verification/hash>
171113
Use Migration Verifier </reference/verification/verifier>
114+
Custom or Manual Verification </reference/verification/custom-manual>
172115

173116
Learn More
174117
----------
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
.. _c2c-custom-manual-verification:
2+
3+
==================================
4+
Custom or Manual Verification Page
5+
==================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. facet::
10+
:name: genre
11+
:values: tutorial
12+
13+
.. contents:: On this page
14+
:local:
15+
:backlinks: none
16+
:depth: 1
17+
:class: singlecol
18+
19+
.. _c2c-document-comparison:
20+
21+
Document Comparison
22+
-------------------
23+
24+
You can verify sync by comparing documents on the source and destination
25+
clusters.
26+
27+
Write a script that queries collections on the source cluster and then checks
28+
that the correct documents, indexes, collections, metadata, and views exist with
29+
the same values on the destination cluster.
30+
31+
Before you can verify data transfer with this method, ``mongosync`` must be in
32+
the ``COMMITTED`` state.
33+
34+
.. _c2c-index-comparison:
35+
36+
Index Comparison
37+
----------------
38+
39+
To verify the transfer of indexes, run the :method:`db.collection.getIndexes`
40+
method on the source and destination clusters and compare the results.
41+
42+
.. _c2c-metadata-comparison:
43+
44+
Metadata Comparison
45+
-------------------
46+
47+
To verify the transfer of metadata, run the :method:`db.getCollectionInfos` method
48+
on the source and destination clusters and compare the results.
49+
50+
.. _c2c-shardkey-comparison:
51+
52+
Shard Key Comparison
53+
--------------------
54+
55+
To verify the transfer of shard keys to a synced collection, run a query on the
56+
``config.collections`` collection to find a document whose ``_id`` value is the
57+
namespace of the target collection. Compare the ``key`` value of this document
58+
in the source and destination clusters.
59+
60+
For example, for a collection named ``pets`` in the ``records`` database, you
61+
can verify the shard key using the following query in :binary:`mongosh`:
62+
63+
.. io-code-block::
64+
:copyable: true
65+
66+
.. input::
67+
:language: javascript
68+
69+
db.getSiblingDB("config").collections.find({ _id : "records.pets" })
70+
71+
.. output::
72+
:language: javascript
73+
:emphasize-lines: 5-7
74+
:visible: false
75+
76+
{
77+
"_id" : "records.pets",
78+
"lastmod" : ISODate("2021-07-21T15:48:15.193Z"),
79+
"timestamp": Timestamp(1626882495, 1),
80+
"key" : {
81+
"_id" : 1
82+
},
83+
"unique" : false,
84+
"lastmodEpoch" : ObjectId("5078407bd58b175c5c225fdc"),
85+
"uuid" : UUID("f8669e52-5c1b-4ea2-bbdc-a00189b341da")
86+
}

0 commit comments

Comments
 (0)