In Mongo, how do I display the indexes of a collection?

TIMEX picture TIMEX · Dec 19, 2010 · Viewed 23.5k times · Source

I just want to display all the indexes in the shell.

Answer

Cameron picture Cameron · Dec 19, 2010

If you want raw access to the indexes, you can query the db.system.indexes collection:

> db.system.indexes.find()

To find the indexes for a specific collection, you can do:

> db.collection.getIndexes()

See this question.