Details
Description
TypeMatchExpression::debugString() and TypeMatchExpression::toBSON() produce incorrect output for {$type: "number"} expressions. The former should produce a string containing "type: number", and the latter should produce the BSON object {$type: "number"}.
As a result, explain output for these queries are incorrect:
> db.foo.find({a:{$type:"number"}}).explain() |
{
|
"queryPlanner" : { |
"plannerVersion" : 1, |
"namespace" : "test.foo", |
"indexFilterSet" : false, |
"parsedQuery" : { |
"a" : { |
"$type" : -1414812757 |
}
|
},
|
"winningPlan" : { |
"stage" : "EOF" |
},
|
"rejectedPlans" : [ ] |
},
|
"serverInfo" : { |
"host" : "rassi", |
"port" : 27017, |
"version" : "0.0.0", |
"gitVersion" : "none" |
},
|
"ok" : 1 |
}
|
>
|
As is the diagnostic log output:
2015-11-06T12:05:16.736-0500 D QUERY [conn1] Beginning planning...
|
=============================
|
Options = INDEX_INTERSECTION KEEP_MUTATIONS
|
Canonical query:
|
ns=test.fooTree: a type: -1414812757
|
Sort: {}
|
Proj: {}
|
=============================
|