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

sort/limit optimization with {$in} expression isn't used if null is one of the values for $in.

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.0
    • Component/s: Index Maintenance
    • Query
    • Fully Compatible
    • ALL

      This looks like a partial regression of SERVER-5777

      My test:
      Index: {a:1, date:-1}
      2.2.x query:

       
      find({a:{$in:[1,2]}}).limit(5).sort({date:-1})  
      

      correctly limits documents (nscanned and nscannedObject to 10).

      find({a:{$in:[null,2]}}).limit(5).sort({date:-1})
      

      same thing.

      2.4.x query:

      find({a:{$in:[1,2]}}).limit(5).sort({date:-1})
      

      correctly limits to 10 docs.

      find({a:{$in:[null,2]}}).limit(5).sort({date:-1})
      

      scans all matching a documents without applying limit.

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: