MongoDB: db.collection.getIndexes() method
db.collection.getIndexes
The db.collection.getIndexes() method is used to return an array that holds a list of documents that identify and describe the existing indexes on a collection.
Syntax:
db.collection.getIndexes()
Sample document in the restaurants collection:
Example: MongoDB: db.collection.getIndexes() method
Following example describe the indexes on the restaurants database
Output:
[ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "test.restaurants" } ]
Retrieve the restaurants data from here
Previous:
db.collection.findOne() method
Next:
db.collection. getShardDistribution() method
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics