Index bounds incorrect in explain for find command with min/max specified

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Enterprise test> db.products.drop()
      Enterprise test> db.products.insert({price: 15})
      Enterprise test> db.products.createIndex({price: 1})
      Enterprise test> db.products.find().min({price: 10}).max({price: 20}).hint({price: 1})
      [ { _id: ObjectId("68c41a559e229c277678382e"), price: 15 } ]
      Enterprise test> db.products.find().min({price: 10}).max({price: 20}).hint({price: 1}).explain().queryPlanner.winningPlan
      {
        isCached: false,
        stage: 'FETCH',
        inputStage: {
          stage: 'IXSCAN',
          keyPattern: { price: 1 },
          indexName: 'price_1',
          isMultiKey: false,
          multiKeyPaths: { price: [] },
          isUnique: false,
          isSparse: false,
          isPartial: false,
          indexVersion: 2,
          direction: 'forward',
          indexBounds: {}
        }
      } 

      As seen in the repro, the indexBounds output by explain when min/max are specified are always empty, despite the command actually returning the correct result.

            Assignee:
            Unassigned
            Reporter:
            Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: