DBAtlas · Database operations atlas

263 OperationNotSupportedInTransaction: Operation not supported inside a multi-document transaction

MongoDB

What 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.

Open in DBAtlas →

More from this engine