Skip to content

Commit ce50164

Browse files
committed
backportting
1 parent 392327f commit ce50164

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source/fundamentals/indexes.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,19 @@ the following:
272272
Refer to the :manual:`Unique Indexes page </core/index-unique>` in the
273273
MongoDB server manual for more information.
274274

275+
List Indexes
276+
------------
277+
278+
You can use the ``listIndexes()`` method to list all of the indexes for
279+
a collection. The `listIndexes()
280+
<{+api+}/classes/Collection.html#listIndexes>`__ method takes an optional
281+
`ListIndexesOptions <{+api+}/interfaces/ListIndexesOptions.html>`__
282+
parameter. The ``listIndexes()`` method returns an object of type
283+
`ListIndexesCursor <{+api+}/classes/ListIndexesCursor.html>`__.
284+
285+
The following code uses the ``listIndexes()`` method to list all the
286+
indexes in a collection:
287+
275288
.. literalinclude:: /code-snippets/indexes/listIndexes.js
276289
:language: js
277290
:start-after: start-listIndexes-example

0 commit comments

Comments
 (0)