You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Document
include Mongoid::Document
include Mongoid::Paranoia
store_in collection: 'documents'
field :timestamps, type: Array, default: []
end
and then we want to perform some actions wrapped in a transaction
document = Document.create
document.with_session do |session|
session.with_transaction(write_concern: {w: :majority}) do
document.push(timestamps: Time.now)
document.destroy
end
end
when we try to perform this code after occurring document.destroy this will hanging ~ 30 seconds and then we see an error
it happens coz we should perform all operations inside the transaction using the same session
The text was updated successfully, but these errors were encountered:
Hello!
When we have
document
class like thisand then we want to perform some actions wrapped in a transaction
when we try to perform this code after occurring
document.destroy
this will hanging ~ 30 seconds and then we see an errorit happens coz we should perform all operations inside the transaction using the same session
The text was updated successfully, but these errors were encountered: