Unexpected behavior of query planner with sparse indices

XMLWordPrintableJSON

    • Type: Question
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.6.1
    • Component/s: Querying
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      I am running mongodb version 2.6.1. I have a sparse index on testField. This query:

      db.testCollection.find({ testField: "123"})

      uses my index. This query:

      db.testCollection.find( {testField: { $exists: true } })

      does this as well. But this query:

      db.testCollection.find({ testField: {$ne: null } })

      perform a full collection scan. According to the documentation: "If a sparse index results in an incomplete result set for queries and sort operations, MongoDB will not use that index". But i don't understand why is the third query result set can't be obtained from the sparse index in my db.
      Is this a bug or am i doing something wrong?

            Assignee:
            Unassigned
            Reporter:
            Sergey Isaev
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: