20 IllegalOperation: Illegal operation
MongoDBWhat does it mean?
The requested operation is invalid/forbidden for the server's current state or the target object's type. MongoDB returns this generic error when it rejects a logically disallowed action.
Why does it happen?
Attempting a collection-only operation on a view; an invalid rename between two databases; a forbidden change on system collections; or an administrative action not allowed by the replica set/sharding configuration. Varies by context.
How to fix it
Read the details of the error message; it usually states explicitly which operation was forbidden and why. Adapt the operation to the target object's type (e.g. work on the underlying collection instead of the view). For rename/move operations, review MongoDB's restrictions (such as renameCollection within the same DB). Check the cluster state (replica set/sharding).
More from this engine
- 202NetworkInterfaceExceededTimeLimit
- 31 RoleNotFoundRole not found
- 263 OperationNotSupportedInTransactionOperation not supported inside a multi-document transaction
- 48 NamespaceExistsNamespace (collection) already exists
- 11601 InterruptedOperation was interrupted
- 85 IndexOptionsConflictIndex already exists with different options / different name
- 67 CannotCreateIndexCannot create index