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

Shard targeting for queries with geo predicates

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.2.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • QO 2021-11-01, QO 2021-11-15, QO 2021-11-29

      The ticket (in the comments) describes a query which combines a btree index with a 2d index. We currently do not believe we are performing shard targeting for geo queries (see comments for code).

       

      This ticket will involve improve the geo targeting in the presence of regular equality predicates. In essence, if we can target based on regular equalities, we should also carry that targeting when we add additional conjunctions to the query (2d or other).

       

       

      use test
       db.test.createIndex(
      { "adminOrder.country": 1, "platformProperties.deliveryID": 1, "_id":1 }
      )
       db.test.createIndex(
      {geometry: "2dsphere"}
      )
       sh.shardCollection("test.test",
      { "adminOrder.country": 1, "platformProperties.deliveryID": 1, "_id":1 }
      )

       

      db.test.find(
      {"adminOrder.country":"USA"}
      ).explain('executionStats')
      

       

      db.test.find({'adminOrder.country':'USA', geometry:{ $near :{$geometry:
      { type: "Point", coordinates: [-122.41284419999998, 47.1478758] }
      ,$minDistance: 0,$maxDistance: 10}}}).explain('executionStats')

            Assignee:
            katherine.wu@mongodb.com Katherine Wu (Inactive)
            Reporter:
            svilen.mihaylov@mongodb.com Svilen Mihaylov (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: