Details
-
Task
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
None
-
Fully Compatible
-
Sharding NYC 2023-04-03
Description
The analyzeShardKey command currently relies on extractShardKeyFromBasicQuery() to extract the shard key from a filter, and it classifies every query that has an empty shard key as not targeting a single shard. The helper cannot handle a filter with $expr. As a result, the analyzeShardKey command currently misclassifies a query that filters by $expr equality on the shard key, for example,
{$expr: {$eq: [$shardKeyField, "$$value"]}. The command should not extract the shard key by itself and instead make use of the query index bounds info determined by getShardIdsForQuery()