|
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.
|