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
* Add support for transactions
Co-authored-by: klinson <[email protected]>
Co-authored-by: levon80999 <[email protected]>
* Start single-member replica set in CI
Co-authored-by: levon80999 <[email protected]>
* Add connection options for faster failures in tests
The faster connection and server selection timeouts ensure we don't spend too much time waiting for the inevitable as we're expecting fast connections on CI systems
Co-authored-by: levon80999 <[email protected]>
* Apply readme code review suggestions
* Simplify replica set creation in CI
* Apply feedback from code review
* Update naming of database env variable in tests
* Use default argument for server selection (which defaults to primary)
* Revert "Simplify replica set creation in CI"
This partially reverts commit 203160e. The simplified call unfortunately breaks tests.
* Pass connection instance to transactional closure
This is consistent with the behaviour of the original ManagesTransactions concern.
* Correctly re-throw exception when callback attempts have been exceeded.
* Limit transaction lifetime to 5 seconds
This ensures that hung transactions don't block any subsequent operations for an unnecessary period of time.
* Add build step to print MongoDB server status
* Update src/Concerns/ManagesTransactions.php
Co-authored-by: Jeremy Mikola <[email protected]>
Co-authored-by: klinson <[email protected]>
Co-authored-by: levon80999 <[email protected]>
Co-authored-by: Jeremy Mikola <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ This package adds functionalities to the Eloquent model and Query builder for Mo
37
37
-[Query Builder](#query-builder)
38
38
-[Basic Usage](#basic-usage-2)
39
39
-[Available operations](#available-operations)
40
+
-[Transactions](#transactions)
40
41
-[Schema](#schema)
41
42
-[Basic Usage](#basic-usage-3)
42
43
-[Geospatial indexes](#geospatial-indexes)
@@ -968,6 +969,52 @@ If you are familiar with [Eloquent Queries](http://laravel.com/docs/queries), th
968
969
### Available operations
969
970
To see the available operations, check the [Eloquent](#eloquent) section.
970
971
972
+
Transactions
973
+
------------
974
+
Transactions require MongoDB version ^4.0 as well as deployment of replica set or sharded clusters. You can find more information [in the MongoDB docs](https://docs.mongodb.com/manual/core/transactions/)
// Abort the transaction, discarding any data created as part of it
1003
+
DB::rollBack();
1004
+
```
1005
+
1006
+
**NOTE:** Transactions in MongoDB cannot be nested. DB::beginTransaction() function will start new transactions in a new created or existing session and will raise the RuntimeException when transactions already exist. See more in MongoDB official docs [Transactions and Sessions](https://www.mongodb.com/docs/manual/core/transactions/#transactions-and-sessions)
0 commit comments