[SERVER-21330] Diagnostic log output and explain output incorrect for {$type: "number"} queries Created: 06/Nov/15  Updated: 05/Feb/16  Resolved: 29/Dec/15

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 3.3.0

Type: Bug Priority: Major - P3
Reporter: J Rassi Assignee: James Wahlin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QuInt E (01/11/16)
Participants:

 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: {}
=============================



 Comments   
Comment by Githook User [ 29/Dec/15 ]

Author:

{u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

Message: SERVER-21330 Incorrect $type explain/diagnostic output for "number"
Branch: master
https://github.com/mongodb/mongo/commit/752bf605cf827d561687ae155d8349a717b3d723

Generated at Thu Feb 08 03:57:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.