Skip to content

Commit 0ba82ee

Browse files
elyse-mdbmdb-ashleyFGasper
authored
(DOCSP-45308) [c2c] add note on how to verify shard keys (#526)
* (DOCSP-45308) Edits. * (DOCSP-45308) Verify shard key. * (DOCSP-45308) Edits. * (DOCSP-45308) Condense code example. * (DOCSP-45308) edits. * (DOCSP-45308) Edits. * Update source/reference/verification.txt Co-authored-by: Ashley Brown <[email protected]> * Update source/reference/verification.txt Co-authored-by: Felipe Gasper <[email protected]> --------- Co-authored-by: Ashley Brown <[email protected]> Co-authored-by: Felipe Gasper <[email protected]>
1 parent 65c6caf commit 0ba82ee

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

source/reference/verification.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,41 @@ source to the destination cluster.
118118
:method:`db.getCollectionInfos` method on the source and
119119
destination clusters and compare the results.
120120

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+
}
155+
121156
* - :ref:`Migration Verifier <c2c-migration-verifier>`
122157
- Migration Verifier connects to the source and destination
123158
clusters and performs a series of verification checks,

0 commit comments

Comments
 (0)