263 OperationNotSupportedInTransaction: Operation not supported inside a multi-document transaction (multi-document 트랜잭션 내에서 지원되지 않는 작업)
MongoDB의미
multi-document 트랜잭션 안에서 해당 컨텍스트에서 지원되지 않는 작업을 시도했다. 일부 명령(특히 특정 DDL 및 메타데이터 작업)은 트랜잭션 안에서 실행할 수 없다.
원인
트랜잭션 안에서 컬렉션/인덱스 생성(버전에 따라 다름), 특정 count/list 계열 명령, 트랜잭션 세션에서 유효하지 않은 관리 명령 같은 지원되지 않는 작업을 실행한 경우다. 이전 MongoDB 버전은 트랜잭션 내 DDL을 지원하지 않는다(일부는 4.4+에서 도입되었다).
해결 방법
지원되지 않는 작업을 트랜잭션 밖으로 옮긴다(예: 트랜잭션 시작 전에 필요한 컬렉션/인덱스를 생성). MongoDB 버전을 확인한다. 4.4+는 트랜잭션 안에서 일부 DDL을 지원한다. 드라이버에서 해당 작업을 별도 세션으로 실행한다. 트랜잭션은 지원되는 CRUD 작업으로 제한한다.
같은 데이터베이스의 다른 항목
- 134ReadConcernMajorityNotAvailableYet
- 202NetworkInterfaceExceededTimeLimit
- 31 RoleNotFoundRole not found
- 20 IllegalOperationIllegal operation
- 48 NamespaceExistsNamespace (collection) already exists
- 11601 InterruptedOperation was interrupted
- 85 IndexOptionsConflictIndex already exists with different options / different name (다른 옵션/이름의 인덱스가 이미 존재)