Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-14628

Aggregation explain "cursor" field truncated

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL

      Description

      Affects 2.6.x.

      When an aggregation explain is run on a cached plan, the server outputs a truncated value for the "cursor" field.

      > db.foo.drop()
      true
      > db.foo.ensureIndex({a:1})
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > db.foo.ensureIndex({b:1})
      {
      	"createdCollectionAutomatically" : false,
      	"numIndexesBefore" : 2,
      	"numIndexesAfter" : 3,
      	"ok" : 1
      }
      > db.foo.insert({a:1,b:2})
      WriteResult({ "nInserted" : 1 })
      > db.foo.insert({a:1,b:2})
      WriteResult({ "nInserted" : 1 })
      > db.foo.insert({a:1,b:2})
      WriteResult({ "nInserted" : 1 })
      > db.foo.aggregate([{$match: {a:1,b:1}}]) // Caches plan.
      > db.foo.aggregate([{$match: {a:1,b:1}}],{explain:true})
      {
      	"stages" : [
      		{
      			"$cursor" : {
      				"query" : {
      					"a" : 1,
      					"b" : 1
      				},
      				"plan" : {
      					"cursor" : "BtreeCursor ", // INCORRECT
      					"isMultiKey" : false,
      					"scanAndOrder" : false,
      					"indexBounds" : {
      						"b" : [
      							[
      								1,
      								1
      							]
      						]
      					},
      					"allPlans" : [
      						{
      							"cursor" : "BtreeCursor ", // INCORRECT
      							"isMultiKey" : false,
      							"scanAndOrder" : false,
      							"indexBounds" : {
      								"b" : [
      									[
      										1,
      										1
      									]
      								]
      							}
      						}
      					]
      				}
      			}
      		}
      	],
      	"ok" : 1
      }
      >

      Aggregation queries with only one solution are affected, as well.

      > db.foo.aggregate([{$match: {a:1}}],{explain:true})
      {
      	"stages" : [
      		{
      			"$cursor" : {
      				"query" : {
      					"a" : 1
      				},
      				"plan" : {
      					"cursor" : "BtreeCursor ", // INCORRECT
      					"isMultiKey" : false,
      					"scanAndOrder" : false,
      					"indexBounds" : {
      						"a" : [
      							[
      								1,
      								1
      							]
      						]
      					},
      					"allPlans" : [
      						{
      							"cursor" : "BtreeCursor ", // INCORRECT
      							"isMultiKey" : false,
      							"scanAndOrder" : false,
      							"indexBounds" : {
      								"a" : [
      									[
      										1,
      										1
      									]
      								]
      							}
      						}
      					]
      				}
      			}
      		}
      	],
      	"ok" : 1
      }
      >

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              david.storch David Storch
              Reporter:
              rassi J Rassi
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: