Skip to content

Commit c700ade

Browse files
committed
Update README.md
Request to add alternative set up for Mongo Eloquent
1 parent f2cc050 commit c700ade

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: README.md

+20
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,26 @@ Tell your model to use the MongoDB model and set the collection (alias for table
6969

7070
Everything else works just like the original Eloquent model. Read more about the Eloquent on http://laravel.com/docs/eloquent
7171

72+
Alternative Eloquent Setting
73+
----------------------------
74+
75+
'aliases' => array(...
76+
'Moloquent' => 'Jenssegers\Mongodb\Model',
77+
);
78+
79+
class MyModel extends Moloquent {
80+
81+
protected $collection = 'mycollection';
82+
83+
}
84+
85+
Add
86+
87+
protected $connection = 'mongodb';
88+
89+
in the MyModel if you have multiple database connections and do not want to overwrite the primary database connection.
90+
91+
7292
Query Builder
7393
-------------
7494

0 commit comments

Comments
 (0)