Hello,
Querying config.collections
returns data that includes the current shard keys of a collection. Resharding a collection with a new shard key changes the corresponding entry in config.collections
. Is there a way to know the old shard keys of the collection i.e. the shard keys before resharding was performed?
Entry in config.collections
before resharding
{
"_id": "src.data",
"lastmodEpoch": {
"$oid": "64340cfd942da8390e3ca588"
},
"lastmod": {
"$date": "2023-04-10T13:19:57.427Z"
},
"timestamp": {
"$timestamp": {
"t": 1681132797,
"i": 6
}
},
"uuid": {
"$binary": {
"base64": "HLO3ebKGT4ONcEFkdwWRqw==",
"subType": "04"
}
},
"key": {
"student.name": 1,
"city": "hashed"
},
"unique": false,
"chunksAlreadySplitForDowngrade": false,
"noBalance": false
}
Entry in config.collections
after resharding
{
"_id": "src.data",
"lastmodEpoch": {
"$oid": "643674a8ccaf8db708026956"
},
"lastmod": {
"$date": "2023-04-12T09:06:48.649Z"
},
"timestamp": {
"$timestamp": {
"t": 1681290408,
"i": 3
}
},
"uuid": {
"$binary": {
"base64": "YzCh1albRzaJ8i3vtCoDLg==",
"subType": "04"
}
},
"key": {
"student.name": 1,
"city": 1,
"order_id": "hashed"
},
"unique": false,
"chunksAlreadySplitForDowngrade": false,
"noBalance": false
}
I can see that config.collections
stores the timestamp at which resharding was performed. But does MongoDB store the historic data on shard keys? If yes, where do we find it?