1
1
title : Click the :guilabel:`Create Index` button.
2
2
level : 4
3
3
ref : create-collection
4
+ stepnum : 1
4
5
content : |
5
- From the :ref:`Indexes <collection-tab>` tab, click the
6
- :guilabel:`Create Index` button to bring up the
6
+ From the :ref:`Indexes <collection-tab>` tab, click
7
+ :guilabel:`Create Index` to open the
7
8
:guilabel:`Create Index` dialog.
8
9
---
9
10
title : Optional. Enter the index name.
10
11
level : 4
11
12
ref : enter-index-name
13
+ stepnum : 2
12
14
content : |
13
15
In the dialog, enter the name of the index to create, or leave blank
14
16
to have MongoDB create a default name for the index.
15
17
---
16
18
title : Add fields to index.
17
19
level : 4
18
20
ref : index-fields
21
+ stepnum : 3
19
22
content : |
20
- To specify a key for the index, select the field and the index type.
21
- To index additional fields, click :guilabel:`Add Another Field`.
23
+
24
+ a. Specify an index key.
25
+
26
+ - To specify an existing document field as an index key, select
27
+ the field from the dropdown list.
28
+
29
+ - To specify a field which does not exist in any document as an
30
+ index key, enter the field name in the input box.
31
+
32
+ - To create a :manual:`compound index </core/index-compound/>`,
33
+ click :guilabel:`Add Another Field`.
34
+
35
+ b. Use the dropdown to the right of each field name to specify the
36
+ index type (``ascending``, ``descending``, or
37
+ :manual:`2dsphere </core/2dsphere/>`).
38
+
39
+ .. seealso::
40
+
41
+ To learn how to specify a wildcard index, see
42
+ :ref:`compass-wildcard-index`.
43
+
22
44
---
23
45
title : Optional. Specify the index options.
24
46
level : 4
25
47
ref : index-options
48
+ stepnum : 4
26
49
content : |
27
50
28
51
|compass-short| supports the following index options:
@@ -37,29 +60,28 @@ content: |
37
60
38
61
* - Build index in the background
39
62
40
- - If checked, ensure that the MongoDB deployment remains
41
- available during the index build operation.
63
+ - Ensure that the MongoDB deployment remains available during
64
+ the index build operation.
42
65
43
66
- :manual:`Background Construction </core/index-creation/index.html#background-construction>`
44
67
45
68
* - Create unique index
46
69
47
- - If checked, ensure that the indexed fields do not
48
- store duplicate values.
70
+ - Ensure that the indexed fields do not store duplicate values.
49
71
50
72
- :manual:`Unique Indexes </core/index-unique>`
51
73
52
- * - Create :abbr:`TTL (Time to Live)`
74
+ * - Create a :abbr:`TTL (Time to Live)` index
53
75
54
- - If checked, automatically delete documents after a
55
- specified number of seconds since the indexed field value.
76
+ - Delete documents automatically after a specified number of
77
+ seconds since the indexed field value.
56
78
57
79
- :manual:`TTL Indexes </core/index-ttl>`
58
80
59
81
* - Partial filter expression
60
82
61
- - If checked, only index documents which match the specified
62
- filter expression.
83
+ - Index only the documents which match the specified filter
84
+ expression.
63
85
64
86
.. example::
65
87
@@ -74,20 +96,38 @@ content: |
74
96
75
97
* - Use custom collation
76
98
77
- - If checked, create a custom collation for the index
78
- using the options provided in |compass-short|.
99
+ - Create a custom collation for the index using the options
100
+ provided in |compass-short|.
79
101
80
102
- :manual:`Collation Document </reference/collation/#collation-document>`
81
103
82
104
* - Wildcard projection (*New in MongoDB 4.2*)
83
105
84
- - If checked, support unknown or arbitrary fields
85
- which match the specified projection in the index.
106
+ - Support unknown or arbitrary fields which match the specified
107
+ projection in the index. To use a wildcard projection, set
108
+ your index field name to ``$**``. This directs
109
+ |compass-short| to use all fields in the document (excluding
110
+ ``_id``).
111
+
112
+ .. example::
113
+
114
+ Consider the following wildcard projection document:
115
+
116
+ .. code-block:: javascript
117
+
118
+ {
119
+ "product_attributes.elements" : 1,
120
+ "product_attributes.resistance" : 1
121
+ }
122
+
123
+ If your index field name is ``$**``, your index only
124
+ includes the values of the fields in that projection.
86
125
87
- - :manual-next:`Wildcard Indexes </core/index -wildcard/> `
126
+ - :ref:`compass -wildcard-index `
88
127
---
89
- title : Click :guilabel:`Create` to create the index .
128
+ title : Click :guilabel:`Create Index` .
90
129
level : 4
91
130
ref : create-index-button
131
+ stepnum : 5
92
132
content : " "
93
133
...
0 commit comments