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
To learn more about index options, see :manual:`Options for All Index Types </reference/method/db.collection.createIndex/#options-for-all-index-types>`
208
230
in the MongoDB server manual.
209
231
@@ -213,10 +235,10 @@ Create Sparse, TTL, and Unique Indexes
213
235
You can use {+odm-short+} helper methods to create the following types of
214
236
indexes:
215
237
216
-
- Sparse indexes which allow index entries only for documents that contain the
238
+
- Sparse indexes, which allow index entries only for documents that contain the
217
239
specified field
218
-
- Time-to-live (TTL) indexes which expire after a set amount of time
219
-
- Unique indexes which prevent inserting documents that contain duplicate
240
+
- Time-to-live (TTL) indexes, which expire after a set amount of time
241
+
- Unique indexes, which prevent inserting documents that contain duplicate
220
242
values for the indexed field
221
243
222
244
To create these index types, call the ``create()`` method on the ``Schema`` facade
@@ -225,7 +247,7 @@ method with a ``MongoDB\Laravel\Schema\Blueprint`` parameter. Call the
225
247
appropriate helper method on the ``Blueprint`` instance and pass the
226
248
index creation details.
227
249
228
-
The following migration code shows how to create a sparse index and TTL index
250
+
The following migration code shows how to create a sparse and TTL index
229
251
by using the index helpers. Click the :guilabel:`VIEW OUTPUT` button to see
230
252
the indexes created by running the migration, including the default index on
231
253
the ``_id`` field:
@@ -253,8 +275,8 @@ the ``_id`` field:
253
275
}
254
276
]
255
277
256
-
You can specify sparse, TTL, and unique indexes on a single field or compound
257
-
index by specifying them in the index options.
278
+
You can specify sparse, TTL, and unique indexes on either a single field or
279
+
compound index by specifying them in the index options.
258
280
259
281
The following migration code shows how to create all three types of indexes
260
282
on a single field. Click the :guilabel:`VIEW OUTPUT` button to see the indexes
@@ -353,41 +375,4 @@ from the ``flights`` collection:
353
375
:start-after: begin drop index
354
376
:end-before: end drop index
355
377
356
-
.. _laravel-eloquent-collections:
357
-
358
-
Manage Collections
359
-
------------------
360
-
361
-
Check if a collection exists: Schema::hasCollection(<collection name>)
362
-
363
-
TODO
364
-
365
-
Note that creating a collection is a noop unless it also creates an index
366
-
since MongoDB automatically creates collections when you first write to them.
367
-
368
-
Notes:
369
-
370
-
- collection (what does this method do?)
371
-
Schema::hasCollection(<collection name>); check whether a collection exists
372
-
373
-
- determining column existence
374
-
- drop collection public function dropIfExists($table)
0 commit comments