Skip to content

Commit 7b2867b

Browse files
committed
Updated readme for #31
1 parent 675bb86 commit 7b2867b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Diff for: README.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ Eloquent
6161
Tell your model to use the MongoDB model and set the collection (alias for table) property. The lower-case, plural name of the class will be used for the collection name, unless another name is explicitly specified.
6262

6363
use Jenssegers\Mongodb\Model as Eloquent;
64-
64+
6565
class MyModel extends Eloquent {
66-
66+
6767
protected $collection = 'mycollection';
68-
68+
6969
}
7070

7171
*You can also specify the connection name in the model by changing the `connection` property.*
@@ -76,7 +76,7 @@ Query Builder
7676
-------------
7777

7878
The database driver plugs right into the original query builder. When using mongodb connections you will be able to build fluent queries to perform database operations. For your convenience, there is a `collection` alias for `table` as well as some additional mongodb specific operations like `push` and `pull`.
79-
79+
8080
// With custom connection
8181
$user = DB::connection('mongodb')->collection('users')->get();
8282

@@ -91,7 +91,7 @@ Schema
9191

9292
The database driver also has (limited) schema builder support. You can easily manipulate collections and set indexes:
9393

94-
Schema::create('users', function($collection)
94+
Schema::create('users', function($collection)
9595
{
9696
$collection->index('name');
9797
$collection->unique('email');
@@ -274,6 +274,13 @@ Or you can access the internal object directly:
274274

275275
### MongoDB specific operations
276276

277+
**Upsert**
278+
279+
Update or insert a document. Additional options for the update method are passed directly to the native update method.
280+
281+
DB::collection('users')->where('name', 'John')
282+
->update($data, array('upsert' => true));
283+
277284
**Push**
278285

279286
Add an items to an array.

0 commit comments

Comments
 (0)