- 
    Type:
Improvement
 - 
    Resolution: Duplicate
 - 
    Priority:
Major - P3
 - 
    None
 - 
    Affects Version/s: None
 - 
    Component/s: Aggregation Framework
 - 
    None
 
- 
        Fully Compatible
 - 
        Query 12 (04/04/16), Query 13 (04/22/16)
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
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-18940as it is an exact shard key match. - This issue is an related but distinct from 
SERVER-7656. 
- duplicates
 - 
                    
SERVER-18940 Optimise sharded aggregations that are targeted to a single shard
-         
 - Closed
 
 -         
 - 
                    
SERVER-21065 Optimizer should consider predicate with "$in" operator having a single argument to be equivalent to the equality operator
-         
 - Closed
 
 -         
 
- is related to
 - 
                    
SERVER-7656 Optimize aggregation on sharded setup if first stage is exact match on shard key
-         
 - Closed
 
 -