Currently, it is a little bit tricky to determine the list of views in a database. There are two options:
- Specifically grant access to the find action on the system.views collection.
- Call listCollections and filter for all entries returned that do not have an options.storageEngine field.
The first option is both tedious (grant needs to be performed for the system.views collection on every database) and also probably not something we really want users to rely on. (See
The second is a little obscure. It does not seem reasonable to assume that an external user can piece together that a view is a collection without a storageEngine.
Suggestion: add a new field to each entry in the output of listCollections that indicates whether or not the entry represents a collection or a view, and add a new option for the supported filters on the listCollections command so that a list of only-views can be returned.