Navigation
This version of the documentation is archived and no longer supported.

listIndexes

New in version 3.0.0.

Definition

listIndexes

Returns information about the indexes on the specified collection. Specifically, the command returns a document that contains information with which to create a cursor to the index information. Index information includes the keys and options used to create the index. The mongo shell provides the db.collection.getIndexes() helper.

The command has the following form:

{ "listIndexes": "<collection-name>" }
Field Type Description
listIndexes string The name of the collection.

Required Access

The user executing the command requires either find privileges on the system.indexes collection or the listIndexes privilege action. At a minimum, the read built-in role provide the requisite permissions.

Output

listIndexes.cursor

A document that contains information with which to create a cursor to index information. The cursor information includes the cursor id, the full namespace for the command, as well as the first batch of results. Index information includes the keys and options used to create the index. For information on the keys and index options, see db.collection.createIndex().

listIndexes.ok

The return value for the command. A value of 1 indicates success.

←   listCollections logRotate  →