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

The "isMultiKey" value is not correct in the output of aggregation explain plan

    XMLWordPrintable

    Details

    • Operating System:
      ALL
    • Backport Completed:
    • Steps To Reproduce:
      Hide

      > db.version()
      2.6.5
      > db.test.insert({x:1, y:[2,3]})
      WriteResult({ "nInserted" : 1 })
      > db.test.ensureIndex({y:1})
      {
      	"createdCollectionAutomatically" : false,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > db.test.find({y:2}).explain()
      {
      	"cursor" : "BtreeCursor y_1",
      	"isMultiKey" : true,
      	"n" : 1,
      	"nscannedObjects" : 1,
      	"nscanned" : 1,
      	"nscannedObjectsAllPlans" : 1,
      	"nscannedAllPlans" : 1,
      	"scanAndOrder" : false,
      	"indexOnly" : false,
      	"nYields" : 0,
      	"nChunkSkips" : 0,
      	"millis" : 0,
      	"indexBounds" : {
      		"y" : [
      			[
      				2,
      				2
      			]
      		]
      	},
      	"server" : "LindaQins-MacBook-Pro.local:22222",
      	"filterSet" : false
      }
      > db.test.aggregate([{$match:{y:2}}], {explain:true})
      {
      	"stages" : [
      		{
      			"$cursor" : {
      				"query" : {
      					"y" : 2
      				},
      				"plan" : {
      					"cursor" : "BtreeCursor ",
      					"isMultiKey" : false,
      					"scanAndOrder" : false,
      					"indexBounds" : {
      						"y" : [
      							[
      								2,
      								2
      							]
      						]
      					},
      					"allPlans" : [
      						{
      							"cursor" : "BtreeCursor ",
      							"isMultiKey" : false,
      							"scanAndOrder" : false,
      							"indexBounds" : {
      								"y" : [
      									[
      										2,
      										2
      									]
      								]
      							}
      						}
      					]
      				}
      			}
      		}
      	],
      	"ok" : 1
      }

      Show
      > db.version() 2.6.5 > db.test.insert({x:1, y:[2,3]}) WriteResult({ "nInserted" : 1 }) > db.test.ensureIndex({y:1}) { "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 } > db.test.find({y:2}).explain() { "cursor" : "BtreeCursor y_1", "isMultiKey" : true, "n" : 1, "nscannedObjects" : 1, "nscanned" : 1, "nscannedObjectsAllPlans" : 1, "nscannedAllPlans" : 1, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 0, "nChunkSkips" : 0, "millis" : 0, "indexBounds" : { "y" : [ [ 2, 2 ] ] }, "server" : "LindaQins-MacBook-Pro.local:22222", "filterSet" : false } > db.test.aggregate([{$match:{y:2}}], {explain:true}) { "stages" : [ { "$cursor" : { "query" : { "y" : 2 }, "plan" : { "cursor" : "BtreeCursor ", "isMultiKey" : false, "scanAndOrder" : false, "indexBounds" : { "y" : [ [ 2, 2 ] ] }, "allPlans" : [ { "cursor" : "BtreeCursor ", "isMultiKey" : false, "scanAndOrder" : false, "indexBounds" : { "y" : [ [ 2, 2 ] ] } } ] } } } ], "ok" : 1 }

      Description

      The $match aggregation pipeline uses a multikey index, however, "isMultiKey" is false in the output of aggregation explain plan.

      Also, the index being used ("y_1") is missing in the field ("cursor" : "BtreeCursor "). It would be nice if the output can be ("cursor" : "BtreeCursor y_1").

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: