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
This package adds functionalities to the Eloquent model and Query builder for MongoDB, using the original Laravel API. _This library extends the original Laravel classes, so it uses exactly the same methods._
10
-
11
-
-[Laravel MongoDB](#laravel-mongodb)
12
-
-[Installation](#installation)
13
-
-[Laravel version Compatibility](#laravel-version-compatibility)
14
-
-[Laravel](#laravel)
15
-
-[Lumen](#lumen)
16
-
-[Non-Laravel projects](#non-laravel-projects)
17
-
-[Testing](#testing)
18
-
-[Database Testing](#database-testing)
19
-
-[Configuration](#configuration)
20
-
-[Eloquent](#eloquent)
21
-
-[Extending the base model](#extending-the-base-model)
22
-
-[Extending the Authenticable base model](#extending-the-authenticable-base-model)
This package adds functionalities to the Eloquent model and Query builder for MongoDB, using the original Laravel API. *This library extends the original Laravel classes, so it uses exactly the same methods.*
11
+
-[Laravel MongoDB](#laravel-mongodb)
12
+
-[Installation](#installation)
13
+
- [Laravel version Compatibility](#laravel-version-compatibility)
14
+
- [Laravel](#laravel)
15
+
- [Lumen](#lumen)
16
+
- [Non-Laravel projects](#non-laravel-projects)
17
+
-[Testing](#testing)
18
+
-[Database Testing](#database-testing)
19
+
-[Configuration](#configuration)
20
+
-[Eloquent](#eloquent)
21
+
-[Extending the base model](#extending-the-base-model)
22
+
-[Extending the Authenticable base model](#extending-the-authenticable-base-model)
@@ -140,7 +142,8 @@ Keep in mind that these traits are not yet supported:
140
142
-`use Database Transactions;`
141
143
-`use RefreshDatabase;`
142
144
143
-
## Configuration
145
+
Configuration
146
+
-------------
144
147
145
148
To configure a new MongoDB connection, add a new connection entry to `config/database.php`:
146
149
@@ -172,7 +175,8 @@ Instead of using a connection string, you can also use the `host` and `port` con
172
175
173
176
The `options` key in the connection configuration corresponds to the [`uriOptions` parameter](https://www.php.net/manual/en/mongodb-driver-manager.construct.php#mongodb-driver-manager.construct-urioptions).
174
177
175
-
## Eloquent
178
+
Eloquent
179
+
--------
176
180
177
181
### Extending the base model
178
182
@@ -770,7 +774,8 @@ DB::collection('users')
770
774
$user->unset('note');
771
775
```
772
776
773
-
## Relationships
777
+
Relationships
778
+
-------------
774
779
775
780
### Basic Usage
776
781
@@ -816,7 +821,7 @@ class Item extends Model
816
821
817
822
### belongsToMany and pivots
818
823
819
-
The belongsToMany relation will not use a pivot "table" but will push id's to a **related_ids** attribute instead. This makes the second parameter for the belongsToMany method useless.
824
+
The belongsToMany relation will not use a pivot "table" but will push id's to a __related_ids__ attribute instead. This makes the second parameter for the belongsToMany method useless.
820
825
821
826
If you want to define custom keys for your relation, set it to `null`:
@@ -1004,7 +1010,8 @@ If you are familiar with [Eloquent Queries](http://laravel.com/docs/queries), th
1004
1010
1005
1011
To see the available operations, check the [Eloquent](#eloquent) section.
1006
1012
1007
-
## Transactions
1013
+
Transactions
1014
+
------------
1008
1015
1009
1016
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/)
1010
1017
@@ -1052,7 +1059,8 @@ DB::commit();
1052
1059
DB::rollBack();
1053
1060
```
1054
1061
1055
-
## Schema
1062
+
Schema
1063
+
------
1056
1064
1057
1065
The database driver also has (limited) schema builder support. You can easily manipulate collections and set indexes.
1058
1066
@@ -1121,7 +1129,8 @@ Schema::create('bars', function ($collection) {
0 commit comments