Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDb C# Transaction has been aborted when writing to database

Tags:

c#

mongodb

I am doing a transaction in a MongoDb database and when inserting or deleting I get the following exception:

Command insert failed: Transaction has been aborted

. However I am not aborting the transaction deliberately. I tried reducing the commands sent to the database to a minimum but the exception still happens.

like image 949
Alejandro Avatar asked Nov 16 '25 22:11

Alejandro


1 Answers

Turns out there was a time limit for transactions. I ran the following command in the mongo shell and the transaction could complete.

db.adminCommand( { setParameter: 1, transactionLifetimeLimitSeconds: 3000 } )
like image 121
Alejandro Avatar answered Nov 18 '25 11:11

Alejandro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!