Skip to content

Commit 815708d

Browse files
authored
Merge pull request #1907 from Giacomo92/patch-1
Added create index documentation
2 parents 39ef853 + c1e02a9 commit 815708d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,18 @@ Schema::create('users', function($collection)
254254
$collection->unique('email');
255255
});
256256
```
257+
You can also pass all the parameters specified in the MongoDB docs [here](https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options-for-all-index-types) in the `$options` parameter. For example:
257258

259+
```
260+
Schema::create('users', function($collection)
261+
{
262+
$collection->index('username',null,null,[
263+
'sparse' => true,
264+
'unique' => true,
265+
'background' => true
266+
]);
267+
});
268+
```
258269
Supported operations are:
259270

260271
- create and drop

0 commit comments

Comments
 (0)