20 IllegalOperation: Illegal operation
MongoDB의미
요청한 작업이 서버의 현재 상태나 대상 객체의 타입에 대해 유효하지 않거나 금지되어 있다. MongoDB는 논리적으로 허용되지 않는 작업을 거부할 때 이 일반 오류를 반환한다.
원인
뷰에서 컬렉션 전용 작업을 시도하거나, 두 데이터베이스 간 잘못된 rename, 시스템 컬렉션에 대한 금지된 변경, replica set/sharding 구성이 허용하지 않는 관리 작업을 시도한 경우다. 컨텍스트에 따라 다르다.
해결 방법
오류 메시지의 세부 내용을 읽는다. 보통 어떤 작업이 왜 금지되었는지 명시되어 있다. 작업을 대상 객체의 타입에 맞게 조정한다(예: 뷰 대신 기반 컬렉션에서 작업). rename/move 작업은 MongoDB의 제약 사항(같은 DB 내 renameCollection 등)을 검토한다. 클러스터 상태(replica set/sharding)를 확인한다.
같은 데이터베이스의 다른 항목
- 202NetworkInterfaceExceededTimeLimit
- 31 RoleNotFoundRole not found
- 263 OperationNotSupportedInTransactionOperation not supported inside a multi-document transaction (multi-document 트랜잭션 내에서 지원되지 않는 작업)
- 48 NamespaceExistsNamespace (collection) already exists
- 11601 InterruptedOperation was interrupted
- 85 IndexOptionsConflictIndex already exists with different options / different name (다른 옵션/이름의 인덱스가 이미 존재)
- 67 CannotCreateIndexCannot create index