-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transaction already in progress #2720
Comments
Tracked with PHPORM-139. |
The initial issue it that MongoDB doesn't support nested transactions, and Laravel Eloquent Query Builder tries to initiate a transaction in the By changing the implementation, we avoid this nested transaction while providing an optimized implementation. |
Do you mean that your implementation will not try to start a new transaction ? |
Yes, because the |
Hi @GromNaN After updating to 4.2.0 we were happy to see that transactions are working fine, Unfortunately "created_at" and "updated_at" fields are no longer automatically inserted in new records using firstOrCreate, createOrFirst, updateOrCreate, ... This code creates new record with "created_at" and "updated_at" fields :
It breaks between 4.1.3 and 4.2.0 Regards. |
Description:
Using firstOrCreate() in a transaction returns an error
Steps to reproduce
Expected behaviour
Manage transaction and commit or rollBack
Actual behaviour
retuns error :
local.ERROR: MongoDB\Driver\Exception\RuntimeException: Transaction already in progress in vendor/mongodb/mongodb/src/Operation/WithTransaction.php:60
Notes
create() works fine
firstOrCreate() and updateOrCreate() do work for updates but do not work for creation as they start a transaction in vendor/mongodb/mongodb/src/Operation/WithTransaction.php
Hack
We went through adding a test in vendor/mongodb/mongodb/src/Operation/WithTransaction.php
The text was updated successfully, but these errors were encountered: