Diagnostic log output and explain output incorrect for {$type: "number"} queries

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 3.3.0
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Fully Compatible
    • ALL
    • QuInt E (01/11/16)
    • None
    • None
    • None
    • None
    • None
    • None
    • None

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

            Assignee:
            James Wahlin
            Reporter:
            J Rassi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: