166 — CommandNotSupportedOnView
queryconfiguration
This command cannot be executed against a view
What is happening?
CommandNotSupportedOnView is returned when a command that only works on collections is executed against a view. Views are stored aggregation pipelines and do not support operations like createIndex, insert, update, delete, findAndModify, mapReduce, or compact. Read operations (find, aggregate) work on views but write operations do not.
Common causes
- Attempting to insert, update, or delete documents on a view
- Trying to create an index on a view
- Running compact, validate, or reIndex against a view
- Application code not distinguishing between collections and views