|
Once the new $hash expression is created in SERVER-49214, we can use a similar agg pipeline as defined in SERVER-49510 to pick new split points during resharding for a shard key with a hashed field. The pipeline should use $hash for a hashed field, it should look like:
[
|
{
|
$sample: { size: numInitialChunks * s (where s = oversampling ratio }
|
},
|
{
|
$project: {
|
_id: 0,
|
"sk0": {$ifNull: ["$shardKeyField0", null]},
|
"sk1": {$toHashedIndexKey: <input>},
|
... and so on for each shard key field
|
}
|
},
|
{
|
$sort: { sk0: 1, sk1: 1 }
|
},
|
]
|
|