20 — IllegalOperation

configurationquery

The requested operation is not permitted in this context

What is happening?

IllegalOperation indicates that a command or operation was attempted in a context where it is not allowed. This can occur when running administrative commands on a secondary, using features that require a specific server configuration, or calling operations that are invalid for the current resource type.

Common causes

  1. Running a write operation against a secondary member
  2. Attempting capped collection operations on a non-capped collection
  3. Using an operation that requires a feature flag not enabled
  4. Attempting to modify a system collection directly

Source code references

ErrorCodes::IllegalOperation found in 252 locations in the MongoDB server source.

Diagnostic Steps

Related Issues