Support additional queries with partial indexes when type is string

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Index Maintenance, Querying
    • None
    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      If an index on a string field is defined using partialFilterExpression "$exists" or "$gt":'' then the partial index is used, however, if it's defined using "$type":"string" then the partial index is not used.

      // for query
      db.c.find({a:'Asya'})
      // this index is used
      db.c.createIndex({a:1},{partialFilterExpression:{a:{$exists:true}}})
      // this index is used
      db.c.createIndex({a:1},{partialFilterExpression:{a:{$gt:''}}})
      // this index is *not* used
      db.c.createIndex({a:1},{partialFilterExpression:{a:{$type:"string"}}})
      

      Similar improvement to SERVER-20345 but for "string" types.

            Assignee:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            Asya Kamsky
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: