-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Fully Compatible
-
ALL
-
v6.0, v5.0, v4.4
-
Sharding EMEA 2022-08-08, Sharding EMEA 2022-08-22
The clientReadable function converts MinKey into {$minElement: 1} for readability purposes. However, the bsonObj {$minElement: 1} does not compare as less than all values the same way that MinKey does.
This is fine for the prettyKey function for logging, but can cause issues when used in the orderShardKeyFields function, whose results are compared. The repro included in this patch triggers the dassert about shard key ordering because the comparison of null and {$minElement: 1} returns null < {$minElement: 1} while minKey should be less than null.
This problem is also present in splitvector - as part of this ticket we should investigate whether this can cause problems on older versions.