|
Queries with projection {a:1.0} should not be considered of a different shape than queries with projection {a:NumberInt(1)}. This can be particularly confusing to users of the plan cache shell helpers, who will see shapes seemingly listed twice when in fact they differ in the BSON type of the projection (as the shell renders them identically).
> db.foo.getPlanCache().clear()
|
> db.foo.find({a:1,b:1},{a:1})
|
> db.foo.getPlanCache().listQueryShapes()
|
[
|
{
|
"query" : {
|
"a" : 1,
|
"b" : 1
|
},
|
"sort" : {
|
|
},
|
"projection" : {
|
"a" : 1
|
}
|
}
|
]
|
> db.foo.find({a:1,b:1},{a:NumberInt(1)})
|
> db.foo.getPlanCache().listQueryShapes()
|
[
|
{ // first query
|
"query" : {
|
"a" : 1,
|
"b" : 1
|
},
|
"sort" : {
|
|
},
|
"projection" : {
|
"a" : 1
|
}
|
},
|
{ // second query, but looks the same
|
"query" : {
|
"a" : 1,
|
"b" : 1
|
},
|
"sort" : {
|
|
},
|
"projection" : {
|
"a" : 1
|
}
|
}
|
]
|
>
|
|