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
Laravel Eloquent add support for ODM (Object Document Mapper) to Laravel. It's the same as Eloquent ORM, but with Documents, since MongoDB is a NoSQL database.
6
+
Laravel Eloquent adds support for ODM (Object Document Mapper) to Laravel. It's the same as Eloquent ORM, but with Documents, since MongoDB is a NoSQL database.
7
7
8
8
Table of contents
9
9
-----------------
@@ -110,7 +110,7 @@ Upgrading
110
110
111
111
In this new major release which supports the new MongoDB PHP extension, we also moved the location of the Model class and replaced the MySQL model class with a trait.
112
112
113
-
Please change all `Jenssegers\Mongodb\Model` references to `Jenssegers\Mongodb\Eloquent\Model` either at the top of your model files, or your registered alias.
113
+
Please change all `Jenssegers\Mongodb\Model` references to `Jenssegers\Mongodb\Eloquent\Model` either at the top of your model files or your registered alias.
114
114
115
115
```php
116
116
use Jenssegers\Mongodb\Eloquent\Model;
@@ -154,7 +154,7 @@ docker-compose up
154
154
155
155
Configuration
156
156
-------------
157
-
You can use MongoDB either as a main database, either as a side database. To do so, add a new `mongodb` connection to `config/database.php`:
157
+
You can use MongoDB either as the main database, either as a side database. To do so, add a new `mongodb` connection to `config/database.php`:
158
158
159
159
```php
160
160
'mongodb' => [
@@ -173,7 +173,7 @@ You can use MongoDB either as a main database, either as a side database. To do
173
173
],
174
174
```
175
175
176
-
For multiple servers or replica set configurations, set the host to array and specify each server host:
176
+
For multiple servers or replica set configurations, set the host to an array and specify each server host:
177
177
178
178
```php
179
179
'mongodb' => [
@@ -186,7 +186,7 @@ For multiple servers or replica set configurations, set the host to array and sp
186
186
],
187
187
```
188
188
189
-
If you wish to use a connection string instead of a full key-value params, you can set it so. Check the documentation on MongoDB's URI format: https://docs.mongodb.com/manual/reference/connection-string/
189
+
If you wish to use a connection string instead of full key-value params, you can set it so. Check the documentation on MongoDB's URI format: https://docs.mongodb.com/manual/reference/connection-string/
190
190
191
191
```php
192
192
'mongodb' => [
@@ -224,7 +224,7 @@ class Book extends Model
224
224
}
225
225
```
226
226
227
-
**NOTE:**MongoDb documents are automatically stored with an unique ID that is stored in the `_id` property. If you wish to use your own ID, substitude the `$primaryKey` property and set it to your own primary key attribute name.
227
+
**NOTE:**MongoDB documents are automatically stored with a unique ID that is stored in the `_id` property. If you wish to use your own ID, substitute the `$primaryKey` property and set it to your own primary key attribute name.
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.
768
+
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.
769
769
770
770
If you want to define custom keys for your relation, set it to `null`:
771
771
@@ -785,7 +785,7 @@ class User extends Model
785
785
786
786
### EmbedsMany Relationship
787
787
788
-
If you want to embed models, rather than referencing them, you can use the `embedsMany` relation. This relation is similar to the `hasMany` relation, but embeds the models inside the parent object.
788
+
If you want to embed models, rather than referencing them, you can use the `embedsMany` relation. This relation is similar to the `hasMany` relation but embeds the models inside the parent object.
789
789
790
790
**REMEMBER**: These relations return Eloquent collections, they don't return query builder objects!
791
791
@@ -998,7 +998,7 @@ MongoDB specific operations:
998
998
- expire
999
999
- geospatial
1000
1000
1001
-
All other (unsupported) operations are implemented as dummy pass-through methods, because MongoDB does not use a predefined schema.
1001
+
All other (unsupported) operations are implemented as dummy pass-through methods because MongoDB does not use a predefined schema.
1002
1002
1003
1003
Read more about the schema builder on [Laravel Docs](https://laravel.com/docs/6.0/migrations#tables)
1004
1004
@@ -1031,11 +1031,11 @@ If you're using a hybrid MongoDB and SQL setup, you can define relationships acr
1031
1031
1032
1032
The model will automatically return a MongoDB-related or SQL-related relation based on the type of the related model.
1033
1033
1034
-
If you want this functionality to work both ways, your SQL-models will need use the `Jenssegers\Mongodb\Eloquent\HybridRelations` trait.
1034
+
If you want this functionality to work both ways, your SQL-models will need to use the `Jenssegers\Mongodb\Eloquent\HybridRelations` trait.
1035
1035
1036
1036
**This functionality only works for `hasOne`, `hasMany` and `belongsTo`.**
1037
1037
1038
-
The MySQL model shoul use the `HybridRelations` trait:
1038
+
The MySQL model should use the `HybridRelations` trait:
0 commit comments