Allow hashed indexes to support $ne queries

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When performing a $ne query such as:

      db.getCollection('users').find({ 'name.middle': { '$ne': null } }).hint({'name.middle': 'hashed'}).explain()
      

      I can see a full table scan is being performed before returning the result and the hash index is being ignored.
      In our case, most of the records would have a null value and thus using the index to quickly reach out to the few relevant documents would have been much more efficient.

      To workaround this, we had to resort to using a regular index on top of the more efficient/small hashed index.

            Assignee:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            Nir Mardiks
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: