263 OperationNotSupportedInTransaction: Operation not supported inside a multi-document transaction
MongoDBWhat does it mean?
An operation not supported in that context was attempted inside a multi-document transaction. Some commands (notably certain DDL and metadata operations) cannot run inside a transaction.
Why does it happen?
Unsupported operations inside the transaction such as creating collections/indexes (depending on version); certain count/list-type commands; or administrative commands not valid in a transaction session. Older MongoDB versions do not support DDL inside transactions (part of it arrived with 4.4+).
How to fix it
Move the unsupported operation out of the transaction (e.g. create the required collections/indexes before the transaction starts). Check your MongoDB version; 4.4+ supports some DDL inside transactions. Run the operation in a separate session in the driver. Limit the transaction to supported CRUD operations.
More from this engine
- 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