In Mongo, how do I display the indexes of a collection? [duplicate]
-
11-10-2019 - |
سؤال
This question already has an answer here:
- A list of indices in MongoDB? 6 answers
I just want to display all the indexes in the shell.
المحلول
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.
لا تنتمي إلى StackOverflow