It is currently possible for DocumentSourceCursor to encounter a view namespace when acquiring a collection lock on what it expects to be a collection. When this occurs it uasserts with 'CommandNotSupportedOnView' which is the correct behavior but not the correct error. We should return a more appropriate error in this scenario which can be reach via the following sequence (and reproducible under an fsm test being written for
- A find is run against a view
- DB & collection locks are dropped for conversion of find to agg on the view
- The view is dropped
- The aggregation is then executed against the former view namespace (executing on the non-view path)
- Aggregation drops the DB & collection locks upon establishing a ClientCursor obj
- The view is recreated
- DocumentSourceCursor attempts to establish DB & collection locks with the understanding that the namespace is a collection. It uasserts with 'CommandNotSupportedOnView' when it finds that the namespace is a view.