- 
    Type:Bug 
- 
    Resolution: Fixed
- 
    Priority:Minor - P4 
- 
    Affects Version/s: None
- 
    Component/s: None
- 
    None
- 
    Environment:OS:
 node.js / npm versions:
 Additional info:
 
- 
        2
- 
        Needed
- 
        
- 
        Developer Tools
Problem Statement/Rationale
When running the aggregate function over a collection, you can send a single aggregation stage without inserting it inside an array. For instance, the following example works properly:
> db.collA.aggregate({$match:{}})
However, it's not possible to run a single aggregation stage over a database:
> db.aggregate({$listLocalSessions: {}})
TypeError: e.some is not a function
Steps to Reproduce
 > db.aggregate({$listLocalSessions: {}})
Expected Results
I would expect either to receive an error explaining that aggregate() is expecting an array, or to execute the aggregation with a single aggregation stage.
Actual Results
We return a misleading error:
TypeError: e.some is not a function