|
When a $match contains an $in array with a single exact shard key match, the aggregation is not targetted to a single shard.
The listed repro produces the following output on 3.0.10:
$ mongo aggregation.js
|
MongoDB shell version: 3.0.10
|
connecting to: test
|
{ "e1" : null }
|
{
|
"e2" : {
|
"shardsPart" : [
|
{
|
"$match" : {
|
"a" : {
|
"$in" : [
|
1
|
]
|
}
|
}
|
}
|
],
|
"mergerPart" : [ ]
|
}
|
}
|
And the following output on 3.2.4:
$ mongo aggregation.js
|
MongoDB shell version: 3.2.4
|
connecting to: test
|
{ "e1" : null }
|
{
|
"e2" : {
|
"shardsPart" : [
|
{
|
"$match" : {
|
"a" : {
|
"$in" : [
|
1
|
]
|
}
|
}
|
}
|
],
|
"mergerPart" : [ ]
|
}
|
}
|
Notes:
- a find with / without the $in is correctly targetted to a single shard.
- I haven't tested multiple $in all targetted but it is likely that will also invoke a merge
- this issue is unrelated to
SERVER-18940 as it is an exact shard key match.
- This issue is an related but distinct from
SERVER-7656.
|