Incorrect query report for $explain

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 2.8.0-rc5
    • Affects Version/s: 2.8.0-rc4
    • Component/s: Logging, Shell
    • None
    • Fully Compatible
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Using .explain() results in a log line like this:

      2015-01-08T00:00:31.433+1100 I QUERY    [conn4] command test.$cmd command: explain { explain: { find: "foo", filter: { a: 1.0 }, options: {} }, verbosity: "queryPlanner" } keyUpdates:0 numYields:0  reslen:383 0ms
      

      But using $explain or ._addSpecial( "$explain", 1 ) results in this log line:

      2015-01-08T00:02:58.169+1100 I QUERY    [conn4] command test.foo command: isMaster { query: { a: 1.0 }, $explain: 1.0 } ntoreturn:0 keyUpdates:0 numYields:0  reslen:801 0ms
      

      I don't know where "isMaster" comes from, but it has nothing to do with the query.

      Also, using different ways of running explain shows different shell behavior (no linebreaks vs. pretty printed output).

      $explain version

      > db.foo.find({$query: {a:1}, $explain: true})
      { "queryPlanner" : { "plannerVersion" : 1, "namespace" : "test.foo", "parsedQuery" : { "a" : { "$eq" : 1 } }, "winningPlan" : { "stage" : "COLLSCAN", "filter" : { "a" : { "$eq" : 1 } }, "direction" : "forward" }, "rejectedPlans" : [ ] }, "executionStats" : { "executionSuccess" : true, "nReturned" : 1, "executionTimeMillis" : 0, "totalKeysExamined" : 0, "totalDocsExamined" : 1, "executionStages" : { "stage" : "COLLSCAN", "filter" : { "a" : { "$eq" : 1 } }, "nReturned" : 1, "executionTimeMillisEstimate" : 0, "works" : 3, "advanced" : 1, "needTime" : 1, "needFetch" : 0, "saveState" : 0, "restoreState" : 0, "isEOF" : 1, "invalidates" : 0, "direction" : "forward", "docsExamined" : 1 }, "allPlansExecution" : [ ] }, "serverInfo" : { "host" : "enter.local", "port" : 27017, "version" : "2.8.0-rc4", "gitVersion" : "3ad571742911f04b307f0071979425511c4f2570" } }
      

      _addSpecial version

      > db.foo.find({a:1})._addSpecial( "$explain", 1 )
      { "queryPlanner" : { "plannerVersion" : 1, "namespace" : "test.foo", "parsedQuery" : { "a" : { "$eq" : 1 } }, "winningPlan" : { "stage" : "COLLSCAN", "filter" : { "a" : { "$eq" : 1 } }, "direction" : "forward" }, "rejectedPlans" : [ ] }, "executionStats" : { "executionSuccess" : true, "nReturned" : 1, "executionTimeMillis" : 0, "totalKeysExamined" : 0, "totalDocsExamined" : 1, "executionStages" : { "stage" : "COLLSCAN", "filter" : { "a" : { "$eq" : 1 } }, "nReturned" : 1, "executionTimeMillisEstimate" : 0, "works" : 3, "advanced" : 1, "needTime" : 1, "needFetch" : 0, "saveState" : 0, "restoreState" : 0, "isEOF" : 1, "invalidates" : 0, "direction" : "forward", "docsExamined" : 1 }, "allPlansExecution" : [ ] }, "serverInfo" : { "host" : "enter.local", "port" : 27017, "version" : "2.8.0-rc4", "gitVersion" : "3ad571742911f04b307f0071979425511c4f2570" } }
      

      .explain() version

      > db.foo.find({a:1}).explain()
      {
      	"queryPlanner" : {
      		"plannerVersion" : 1,
      		"namespace" : "test.foo",
      		"parsedQuery" : {
      			"a" : {
      				"$eq" : 1
      			}
      		},
      		"winningPlan" : {
      			"stage" : "COLLSCAN",
      			"filter" : {
      				"a" : {
      					"$eq" : 1
      				}
      			},
      			"direction" : "forward"
      		},
      		"rejectedPlans" : [ ]
      	},
      	"serverInfo" : {
      		"host" : "enter.local",
      		"port" : 27017,
      		"version" : "2.8.0-rc4",
      		"gitVersion" : "3ad571742911f04b307f0071979425511c4f2570"
      	},
      	"ok" : 1
      }
      

              Assignee:
              Eric Milkie
              Reporter:
              Thomas Rueckstiess (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: