- 
    Type:
Bug
 - 
    Resolution: Fixed
 - 
    Priority:
Major - P3
 - 
    Affects Version/s: None
 - 
    Component/s: None
 - 
    None
 
- 
        Fully Compatible
 - 
        ALL
 - 
        
 - 
        Query 2020-12-28, Query 2021-01-25, Query Optimization 2021-02-22, Query Optimization 2021-03-08, Query Optimization 2021-03-22, Query Optimization 2021-04-05
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
In three additional cases (beyond the ones described in SERVER-35479 and SERVER-35522) the results of collStats depends on the topology of the server. 
Currently, if one attaches to a standalone instance of mongo, one will receive the NamespaceNotFound error code if one asks for collStats with the queryExecStats or storageStats options on a namespace that doesn't exist (e.g. "dne"). Additionally, one will receive a numeric error code if one passes an unknown option (e.g. "unknown").
However, if one connects to a mongos the NamespaceNotFound errors will be suppressed by the mongos instance if one pass such options to a namespace that doesn't exist. Additionally, because we don't validate that the options passed to collStats are correct when we do a "light parse" of the pipeline we actually get a NamespaceNotFound error when we get the routing info which then gets suppressed by the same code path if one asks for collStats on a collection that doesn't exist with an unknown option.
Resolution of this ticket should include:
1) Stopping mongos from suppressing namespace not found errors. 
2) Ensuring that mongos produces an option validation error before a namespace not found error in the event of unknown options being passed to a collStats stage being run on a nonexistent namespace.
3) Tests to verify that collStats behaves correctly regardless of topology.
- is related to
 - 
                    
SERVER-35479 Make $collStats count behavior have "standard" error code and consistent behavior across topologies.
-         
 - Closed
 
 -         
 
- related to
 - 
                    
SERVER-54470 Add $collStats aggregate pipeline stage to API version 1
-         
 - Closed
 
 -