Simple query on _id with $eq should use IDHACK

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.8.0-rc0
    • Component/s: Querying
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      A simple equality query against _id results in IDHACK. When the $eq operator is supplied, the equivalent query uses IXSCAN.

      db.simpleid.find({ "_id" : 1 }).explain()
      db.simpleid.find({ "_id" : { "$eq" : 1 } }).explain()
      

      Other equivalent queries, which may not be considered simple, also use IXSCAN:

      db.simpleid.find({ $or : [{ _id : { $eq : 1 } }] }).explain()
      db.simpleid.find({ $and : [{ _id : { $all : [1] } }] }).explain()
      

            Assignee:
            Unassigned
            Reporter:
            Jonathan Abrahams (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: