|
| 1 | +title: Navigate to the collection for which you wish to create the index. |
| 2 | +level: 4 |
| 3 | +ref: navigate-to-collection |
| 4 | +content: | |
| 5 | + |
| 6 | + a. In the left-hand MongoDB Compass navigation pane, click the |
| 7 | + database that contains your desired collection. |
| 8 | + |
| 9 | + #. From the database view, click the target collection name. |
| 10 | +--- |
| 11 | +title: Click the :guilabel:`Create Index` button. |
| 12 | +level: 4 |
| 13 | +ref: create-collection |
| 14 | +content: | |
| 15 | + From the :ref:`Indexes <collection-tab>` tab, click the |
| 16 | + :guilabel:`Create Index` button to bring up the |
| 17 | + :guilabel:`Create Index` dialog. |
| 18 | +--- |
| 19 | +title: Optional. Enter the index name. |
| 20 | +level: 4 |
| 21 | +ref: enter-index-name |
| 22 | +content: | |
| 23 | + In the dialog, enter the name of the index to create, or leave blank |
| 24 | + to have MongoDB create a default name for the index. |
| 25 | +--- |
| 26 | +title: Add fields to index. |
| 27 | +level: 4 |
| 28 | +ref: index-fields |
| 29 | +content: | |
| 30 | + To specify a key for the index, select the field and the index type. |
| 31 | + To index additional fields, click :guilabel:`Add Another Field`. |
| 32 | +--- |
| 33 | +title: Optional. Specify the index options. |
| 34 | +level: 4 |
| 35 | +ref: index-options |
| 36 | +content: | |
| 37 | +
|
| 38 | + Compass supports the following index options: |
| 39 | +
|
| 40 | + .. list-table:: |
| 41 | + :header-rows: 1 |
| 42 | + :widths: 40 60 20 |
| 43 | +
|
| 44 | + * - Option |
| 45 | + - Description |
| 46 | + - More Information |
| 47 | +
|
| 48 | + * - Build index in the background |
| 49 | +
|
| 50 | + - If checked, ensure that the MongoDB deployment remains |
| 51 | + available during the index build operation. |
| 52 | +
|
| 53 | + - :manual:`Background Construction </core/index-creation/index.html#background-construction>` |
| 54 | +
|
| 55 | + * - Create unique index |
| 56 | +
|
| 57 | + - If checked, ensure that the indexed fields do not |
| 58 | + store duplicate values. |
| 59 | +
|
| 60 | + - :manual:`Unique Indexes </core/index-unique>` |
| 61 | +
|
| 62 | + * - Create :abbr:`TTL (Time to Live)` |
| 63 | +
|
| 64 | + - If checked, automatically delete documents after a |
| 65 | + specified number of seconds since the indexed field value. |
| 66 | +
|
| 67 | + - :manual:`TTL Indexes </core/index-ttl>` |
| 68 | +
|
| 69 | + * - Partial filter expression |
| 70 | + |
| 71 | + - If checked, only index documents which match the specified |
| 72 | + filter expression. |
| 73 | +
|
| 74 | + .. example:: |
| 75 | +
|
| 76 | + The following partial filter expression only indexes |
| 77 | + documents where the ``timezone`` field exists: |
| 78 | +
|
| 79 | + .. code-block:: js |
| 80 | +
|
| 81 | + { "timezone": { "$exists": true } } |
| 82 | + |
| 83 | + - :manual:`Partial Indexes </core/index-partial/>` |
| 84 | +
|
| 85 | + * - Use custom collation |
| 86 | +
|
| 87 | + - If checked, create a custom collation for the index |
| 88 | + using the options provided in Compass. |
| 89 | +
|
| 90 | + - :manual:`Collation Document </reference/collation/#collation-document>` |
| 91 | +
|
| 92 | + * - Wildcard projection (*New in MongoDB 4.2*) |
| 93 | + |
| 94 | + - If checked, support unknown or arbitrary fields |
| 95 | + which match the specified projection in the index. |
| 96 | +
|
| 97 | + - :manual-next:`Wildcard Indexes </core/index-wildcard/>` |
| 98 | +--- |
| 99 | +title: Click :guilabel:`Create` to create the index. |
| 100 | +level: 4 |
| 101 | +ref: create-index-button |
| 102 | +content: "" |
| 103 | +... |
0 commit comments