mongodb/mongoid · error · Mongoid::Errors::TransactionsNotSupported
Transactions are not supported by the connected server(s).
Error message
Transactions are not supported by the connected server(s).
What it means
Error "Transactions are not supported by the connected server(s)." thrown in mongodb/mongoid.
Source
Thrown at lib/mongoid/clients/sessions.rb:87
# @param [ Hash ] options The transaction options. Please see the driver
# documentation for the available session options.
# @param [ Hash ] session_options The session options. A MongoDB
# transaction must be started inside a session, therefore a session will
# be started. Please see the driver documentation for the available session options.
#
# @raise [ Mongoid::Errors::InvalidTransactionNesting ] If the transaction is
# opened on a client that already has an open transaction.
# @raise [ Mongoid::Errors::TransactionsNotSupported ] If MongoDB deployment
# the client is connected to does not support transactions.
# @raise [ Mongoid::Errors::TransactionError ] If there is an error raised
# by MongoDB deployment or MongoDB driver.
#
# @yield Provided block will be executed inside a transaction.
def transaction(options = {}, session_options: {}, &block)
with_session(session_options) do |session|
session.with_transaction(options, &block).tap { run_commit_callbacks(session) }
rescue *transactions_not_supported_exceptions
raise Mongoid::Errors::TransactionsNotSupported
rescue Mongoid::Errors::Rollback
run_abort_callbacks(session)
rescue Mongoid::Errors::InvalidSessionNesting
# Session should be ended here.
raise Mongoid::Errors::InvalidTransactionNesting.new
rescue Mongo::Error::InvalidSession, Mongo::Error::InvalidTransactionOperation => e
run_abort_callbacks(session)
raise Mongoid::Errors::TransactionError.new(e)
rescue StandardError => e
run_abort_callbacks(session)
raise e
end
end
# Sets up a callback is called after a commit of a transaction.
# The callback is called only if the document is created, updated, or destroyed
# in the transaction.
#View on GitHub (pinned to 0da0e23d71)
When it happens
Trigger: Thrown at lib/mongoid/clients/sessions.rb:87 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mongodb/mongoid@0da0e23d71 (2026-08-23).
Data as JSON: /api/errors/7c7d48797dbe9963.
Report an issue: GitHub.