Wrong index is being used, causing inefficient queries

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.6.4
    • Component/s: Querying
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      I have a collection with two fields. One is a string and another is an ObjectId.
      I have indices on both fields.
      When doing a query such as {'string_field' : 'some value', 'other_obj_id' : {$exists : true}}, the index used for the query is consistently the one on 'other_obj_id' and not the one on 'string_field', although that one would be much faster.

      This staretd to happen as soon as I've upgraded to 2.6.4 and is a degradation from 2.6.1 !

            Assignee:
            Ramon Fernandez Marina
            Reporter:
            Baruch Oxman
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: