Index bounds are not detected correctly

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.4.2
    • Component/s: Querying
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Documents with two fields: {sort:..,x:...}
      Index on {sort:1,x:1}

      The query on "x" sorted by the sort field doesn't detect proper index bounds for x:

      > db.test.find({x:{$gte:1,$lte:3}}).sort({sort:1}).explain("executionStats").executionStats.executionStages.inputStage.indexBounds
      { "sort" : [ "[MinKey, MaxKey]" ], "x" : [ "[MinKey, MaxKey]" ] }
      

      However, adding an all-inclusive condition on "sort" into the query fixes the problem:

      > db.test.find({sort:{$gte:MinKey},x:{$gte:1,$lte:3}}).sort({sort:1}).explain("executionStats").executionStats.executionStages.inputStage.indexBounds
      { "sort" : [ "[MinKey, MaxKey]" ], "x" : [ "[1.0, 3.0]" ] }
      

            Assignee:
            David Storch
            Reporter:
            Alexander Komyagin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: