-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: 3.6.0, 3.7.1
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
-
ALL
-
v3.6
-
Query 2018-03-12, Query 2018-03-26, Query 2018-04-09
-
None
-
None
-
None
-
None
-
None
-
None
-
None
When an explain is run on a pipeline that must execute entirely on mongoS, the result is an empty cursor batch rather than an explain plan:
mongos> db.adminCommand({explain: {aggregate: 1, pipeline: [{$listLocalSessions:
{}}], cursor: {}}})
{
"cursor" : {
"firstBatch" : [ ],
"id" : NumberLong(0),
"ns" : "admin.$cmd.aggregate"
},
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1519932263, 2),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
},
"operationTime" : Timestamp(1519932263, 2)
}
Instead, the output should be an explain plan indicating that this is a mongoS-only pipeline:
mongos> db.adminCommand({explain: {aggregate: 1, pipeline: [{$listLocalSessions: {}}], cursor: {}}})
{
"splitPipeline" : null,
"mongos" : {
"host" : "Bernards-MacBook-Pro-2.local:27017",
"stages" : [
{
"$listLocalSessions" : {
"allUsers" : false,
"users" : [
{
"user" : "",
"db" : ""
}
]
}
}
]
},
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1520430504, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
},
"operationTime" : Timestamp(1520430504, 1)
}