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

Optimized $group/DISTINCT_SCAN does not respect hint

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 4.1.10
    • 4.2.0-rc3, 4.3.1
    • Querying
    • None
    • Fully Compatible
    • ALL
    • v4.2
    • Query 2019-06-17

    Description

      > 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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: