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