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

Optimized $group/DISTINCT_SCAN does not respect hint

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.2.0-rc3, 4.3.1
    • Affects Version/s: 4.1.10
    • Component/s: Querying
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v4.2
    • Query 2019-06-17

      > db.c.createIndex({a:1})
      > db.c.insert({a:1})
      WriteResult({ "nInserted" : 1 })
      > db.c.aggregate({$group: {_id: "$a"}})
      { "_id" : 1 }
      > db.c.explain().aggregate({$group: {_id: "$a"}})
      // Distinct scan!
      > db.c.explain().aggregate([{$group: {_id: "$a"}}], {hint: {$natural: 1}})
      // Still distinct scan
      

      This is probably because of the special codepath here which doesn't consider the hint.

            Assignee:
            misha.ivkov@mongodb.com Mikhail Ivkov (Inactive)
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: