A list of indices in MongoDB?
问题 Is there a way to see a list of indices on a collection in mongodb in shell? i read through http://www.mongodb.org/display/DOCS/Indexes but i dont see anything 回答1: From the shell: db.test.getIndexes() For shell help you should try: help; db.help(); db.test.help(); 回答2: And if you want to get list of all indexes in your database: use "yourdbname" db.system.indexes.find() 回答3: If you want to list all indexes: db.getCollectionNames().forEach(function(collection) { indexes = db[collection]