|
It would seem that the Explain Plan is not taking the Collation arguments into account when performing the query. When doing explain() on a shell, it shows me using the index, Compass does not (see attached image).
db.users.find({username:'mark.garrett@allcarepharmacy.com', isActive: true}).collation({locale:'en', strength: 2}).explain()
|
{
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "spp.users",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
"$and" : [
|
{
|
"isActive" : {
|
"$eq" : true
|
}
|
},
|
{
|
"username" : {
|
"$eq" : "mark.garrett@allcarepharmacy.com"
|
}
|
}
|
]
|
},
|
"collation" : {
|
"locale" : "en",
|
"caseLevel" : false,
|
"caseFirst" : "off",
|
"strength" : 2,
|
"numericOrdering" : false,
|
"alternate" : "non-ignorable",
|
"maxVariable" : "punct",
|
"normalization" : false,
|
"backwards" : false,
|
"version" : "57.1"
|
},
|
"winningPlan" : {
|
"stage" : "FETCH",
|
"inputStage" : {
|
"stage" : "IXSCAN",
|
"keyPattern" : {
|
"username" : 1,
|
"isActive" : 1
|
},
|
"indexName" : "username_1_isActive_1",
|
"collation" : {
|
"locale" : "en",
|
"caseLevel" : false,
|
"caseFirst" : "off",
|
"strength" : 2,
|
"numericOrdering" : false,
|
"alternate" : "non-ignorable",
|
"maxVariable" : "punct",
|
"normalization" : false,
|
"backwards" : false,
|
"version" : "57.1"
|
},
|
"isMultiKey" : false,
|
"multiKeyPaths" : {
|
"username" : [ ],
|
"isActive" : [ ]
|
},
|
"isUnique" : true,
|
"isSparse" : false,
|
"isPartial" : false,
|
"indexVersion" : 2,
|
"direction" : "forward",
|
"indexBounds" : {
|
"username" : [
|
"[\"A)K=\b5)KK1OO\nz)??-)K1G7)KA)-Y\b-EA\u0001$\", \"A)K=\b5)KK1OO\nz)??-)K1G7)KA)-Y\b-EA\u0001$\"]"
|
],
|
"isActive" : [
|
"[true, true]"
|
]
|
}
|
}
|
},
|
"rejectedPlans" : [ ]
|
},
|
"serverInfo" : {
|
"host" : "xxxxxxxxxxxxxxxx",
|
"port" : 27017,
|
"version" : "4.0.4-1",
|
"gitVersion" : "8664823baee70273f47949a8cde68bde37c69930"
|
},
|
"ok" : 1
|
}
|
|