File tree Expand file tree Collapse file tree 4 files changed +14
-7
lines changed Expand file tree Collapse file tree 4 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ fun main() {
34
34
collection.dropIndex(" _title_" )
35
35
// end-remove-index
36
36
37
+ // start-remove-all-indexes
38
+ collection.dropIndexes()
39
+ // end-remove-all-indexes
40
+
37
41
// start-index-single
38
42
collection.createIndex(Indexes .ascending(Movie ::title.name))
39
43
// end-index-single
Original file line number Diff line number Diff line change @@ -64,8 +64,7 @@ The following example creates an ascending index on the specified field:
64
64
:copyable:
65
65
:dedent:
66
66
67
- .. TODO: To learn more about single field indexes, see the
68
- .. :ref:`kotlin-sync-single-field-index` guide.
67
+ To learn more about single field indexes, see the :ref:`kotlin-sync-single-field-index` guide.
69
68
70
69
Compound Index
71
70
--------------
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ The following example creates an index in ascending order on the ``title`` field
56
56
:end-before: end-index-single
57
57
:language: kotlin
58
58
:copyable:
59
+ :dedent:
59
60
60
61
The following is an example of a query that is covered by the index created in the preceding code example:
61
62
Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ Overview
25
25
--------
26
26
27
27
In this guide, you can learn how to use **indexes** with the {+driver-short+}.
28
- Indexes can improve the efficiency of queries and add additional functionality
29
- to querying and storing documents.
28
+ Indexes can improve the efficiency of queries and add functionality to querying and
29
+ storing documents.
30
30
31
31
Without indexes, MongoDB must scan every document in a collection to find the
32
32
documents that match each query. These collection scans are slow and can negatively affect
@@ -94,6 +94,7 @@ collection:
94
94
:language: kotlin
95
95
:start-after: start-remove-index
96
96
:end-before: end-remove-index
97
+ :dedent:
97
98
98
99
.. note::
99
100
@@ -107,9 +108,11 @@ Delete All Indexes
107
108
Starting with MongoDB 4.2, you can drop all indexes by calling the
108
109
``dropIndexes()`` method on your collection:
109
110
110
- .. code-block:: kotlin
111
-
112
- collection.dropIndexes()
111
+ .. literalinclude:: /includes/indexes/indexes.kt
112
+ :language: kotlin
113
+ :start-after: start-remove-all-indexes
114
+ :end-before: end-remove-all-indexes
115
+ :dedent:
113
116
114
117
API Documentation
115
118
~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments