File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1036,6 +1036,29 @@ majority of data-bearing voting members "vote" to commit the index
1036
1036
build. For more information on index builds and the voting process, see
1037
1037
:ref:`index-operations-replicated-build`.
1038
1038
1039
+ Create Multiple Indexes
1040
+ ~~~~~~~~~~~~~~~~~~~~~~~
1041
+
1042
+ .. include:: /includes/cakeSales-example-collection.rst
1043
+
1044
+ The following example creates multiple indexes on the ``cakeSales``
1045
+ collection:
1046
+
1047
+ .. code-block:: javascript
1048
+
1049
+ db.cakeSales.createIndexes( [
1050
+ { "type": 1 },
1051
+ { "orderDate": 1 },
1052
+ { "state": 1 },
1053
+ { "orderDate": 1, "state": -1 }
1054
+ ] )
1055
+
1056
+ The first three indexes are on single fields and in ascending order
1057
+ (``1``).
1058
+
1059
+ The last index is on ``orderDate`` in ascending order (``1``) and
1060
+ ``state`` in descending order (``-1``).
1061
+
1039
1062
Additional Information
1040
1063
----------------------
1041
1064
You can’t perform that action at this time.
0 commit comments