From 0b74edb04fc07c333cbaf3b6b48a181392e193a8 Mon Sep 17 00:00:00 2001 From: Giacomo Fabbian Date: Thu, 16 Jan 2020 09:51:13 +0100 Subject: [PATCH 1/2] Added create index documentation --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index a6fc96e39..3487a675c 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,18 @@ Schema::create('users', function($collection) $collection->unique('email'); }); ``` +You can also pass all the parameter 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: +``` +Schema::create('users', function($collection) +{ + $collection->index('username',null,null,[ + 'sparse' => true, + 'unique' => true, + 'background' => true + ]); +}); +``` Supported operations are: - create and drop From c1e02a92dbd805d6736bca6458b8e9678fceb19b Mon Sep 17 00:00:00 2001 From: Giacomo Fabbian Date: Thu, 16 Jan 2020 09:54:19 +0100 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3487a675c..29079ab0a 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,7 @@ Schema::create('users', function($collection) $collection->unique('email'); }); ``` -You can also pass all the parameter 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: +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: ``` Schema::create('users', function($collection)