laravel-mongodb
laravel-mongodb copied to clipboard
Add transaction support
requires mongodb version V4.0 or more and deployment replica sets or sharded clusters transaction support create/insert,update,delete,etc operation Supports infinite-level nested transactions, but outside transaction rollbacks do not affect the commit of inside transactions
DB::beginTransaction();
DB::collection('users')->where('name', 'klinson')->update(['age' => 18]);
DB::transaction(function () {
DB::collection('users')->where('name', 'mongodb')->update(['age' => 30]);
});
DB::rollBack();
@klinson check failed tests in travis build please
@Smolevich Because transaction requires mongodb version V4.0 or more and deployment replica sets or sharded clusters, but your environment doesn't.
@klinson, Not my environment, it is common configuration based on official docker images, you can change if it's needed
@klinson if you work on PR, add 'WIP' to title of PR
@Smolevich I've modified the environment to support it
@jenssegers i prepare https://github.com/Smolevich/demo-mongo-application/pull/9 for demo. It is not finished, but today i finish
@klinson do you have plans to add changes for PR?
I will continue to change it
@klinson do you have plans to work on this PR?
whats your plan about this MR, i need this really. @Smolevich @klinson @jenssegers If you need help or anything i can help to fix this problem i need this immediately. Thanks
Merge master, please @klinson
How to do? @Giacomo92
See here @klinson
@divine I will do it today
@divine My network can't connect github, I'll try again tomorrow
@klinson, please add another testsuite for transactional tests in phpunit.xml and i prepare new ci file for running only transactional tests
For example see https://github.com/jenssegers/laravel-mongodb/blob/master/phpunit.xml.dist#L28
@Smolevich Hello, I am a user of jenssegers/laravel-mongodb. As i see currently there is no support of multi doc transaction handling in jenssegers and you people are working on it. Reference to https://github.com/jenssegers/laravel-mongodb/issues/1334 also. Is there any fix 'temporarily' (until jenssegers comes up) to handle this in laravel along with jenssegers and MongoDb/Client because my code is using jenssegers Models at many places in the code. So i don't want to use raw MongoDb/Client alone which required lot of changes and thus, I want to use MongoDB/Client with jenssegers instead of just MongoDB/Client. Any code snippet will be appreciated. Thanks
Any update on this ? Is this part of the Develop branch already ?
Any update on this ? Is this part of the Develop branch already ?
Not part of develop branch. Sorry, still no updates so far.
@Smolevich I have added another testsuite for transactional tests in phpunit.xml.What should I do next?
@talnizer @ksgush1 @divine Sorry, I stopped coding because of the epidemic. Now I'm going to keep completing it.
@klinson i will see on your changes and go back with answer
@klinson can you copy part for ci from this PR or i can implemente this functionality at master ?
@Smolevich Can I invite you into the project?
Codecov Report
Merging #1904 into master will increase coverage by
0.57%
. The diff coverage is95.91%
.
@@ Coverage Diff @@
## master #1904 +/- ##
============================================
+ Coverage 86.90% 87.47% +0.57%
- Complexity 664 683 +19
============================================
Files 33 31 -2
Lines 1573 1581 +8
============================================
+ Hits 1367 1383 +16
+ Misses 206 198 -8
Impacted Files | Coverage Δ | Complexity Δ | |
---|---|---|---|
src/Jenssegers/Mongodb/Connection.php | 91.48% <92.00%> (+0.18%) |
47.00 <9.00> (+9.00) |
|
src/Jenssegers/Mongodb/Query/Builder.php | 89.77% <100.00%> (+0.50%) |
173.00 <3.00> (+10.00) |
|
...gers/Mongodb/Auth/PasswordResetServiceProvider.php | 25.00% <0.00%> (-8.34%) |
2.00% <0.00%> (ø%) |
|
src/Jenssegers/Mongodb/Collection.php | 88.88% <0.00%> (-0.59%) |
5.00% <0.00%> (ø%) |
|
src/Jenssegers/Mongodb/Eloquent/Builder.php | 87.71% <0.00%> (-0.42%) |
22.00% <0.00%> (ø%) |
|
...enssegers/Mongodb/Helpers/QueriesRelationships.php | 92.98% <0.00%> (-0.24%) |
28.00% <0.00%> (ø%) |
|
src/Jenssegers/Mongodb/Relations/BelongsToMany.php | 85.85% <0.00%> (-0.15%) |
42.00% <0.00%> (ø%) |
|
src/Jenssegers/Mongodb/Relations/EmbedsMany.php | 97.14% <0.00%> (-0.11%) |
45.00% <0.00%> (ø%) |
|
src/Jenssegers/Mongodb/Eloquent/Model.php | 94.80% <0.00%> (-0.10%) |
82.00% <0.00%> (-1.00%) |
|
... and 10 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update dd6f667...9e0cfd2. Read the comment docs.
@klinson well done! Could you please take a loot at @Smolevich https://github.com/jenssegers/laravel-mongodb/pull/1904#discussion_r447489996?
Please merge this PR ? @Smolevich
Any news?
Any news?
There are important problems that needs to be fixed before merging this so no updates planned for now at least.
Thanks!
Thanks for the answer. What problems still need to be solved? I see practically solved problems in PR.
Thanks for the answer. What problems still need to be solved? I see practically solved problems in PR.
- Why test are failing?
- Problems not related to this PR, however a library itself; see this discussion https://github.com/jenssegers/laravel-mongodb/issues/1974
Thanks!
Codecov Report
Merging #1904 (041d02b) into master (09fcda8) will increase coverage by
0.31%
. The diff coverage is95.55%
.
@@ Coverage Diff @@
## master #1904 +/- ##
============================================
+ Coverage 86.93% 87.24% +0.31%
- Complexity 663 675 +12
============================================
Files 33 33
Lines 1554 1592 +38
============================================
+ Hits 1351 1389 +38
Misses 203 203
Impacted Files | Coverage Δ | Complexity Δ | |
---|---|---|---|
src/Jenssegers/Mongodb/Connection.php | 91.48% <92.00%> (+0.18%) |
47.00 <9.00> (+9.00) |
|
src/Jenssegers/Mongodb/Query/Builder.php | 89.54% <100.00%> (+0.62%) |
165.00 <3.00> (+3.00) |
|
...Jenssegers/Mongodb/MongodbQueueServiceProvider.php | 100.00% <0.00%> (+16.66%) |
2.00% <0.00%> (ø%) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 09fcda8...041d02b. Read the comment docs.
Any update on transactions support?
any news?
@klinson copy current ci part . See here
Any news guys? Can you review please @jenssegers ?
review please @Smolevich
Any updates on this branch being merged, it looks so close to being completed
@jenssegers ... when is this package going to support multi-document transactions?
Any status on transactions support? Really appreciate this feature to be there. Thanks
Any update so far?