- 
    Type:
Bug
 - 
    Resolution: Done
 - 
    Priority:
Major - P3
 - 
    Affects Version/s: None
 - 
    Component/s: Aggregation Framework
 - 
    None
 
- 
        Fully Compatible
 - 
        ALL
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
On a single system the following aggregation can't return a count > 10:
db.foo.aggregate({$limit:10}, {$group: {_id:1, count: {$sum:1}}})
On a sharded system, this can return a count of 10 * numShards.
We probably want the limit applied both on the shard (for speedup) and on the mongos (for correctness).
Luckily, this isn't likely to affect many users since $limit usually follows a $sort or a $group which both force everything after to run in mongos.