Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-75312

analyzeShardKey command misclassifies queries with $expr equality on the shard key

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Sharding NYC 2023-04-03

      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()

            Assignee:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Reporter:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: