|
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
|
}
|
>
|
|