发布于 2015-09-14 15:01:48 | 210 次阅读 | 评论: 0 | 来源: 网络整理
Returns an array that holds a list of documents that identify and describe the existing indexes on the collection. You must call the db.collection.getIndexes() on a collection. For example:
db.collection.getIndexes()
Change collection to the name of the collection whose indexes you want to learn.
The db.collection.getIndexes() items consist of the following fields:
Holds the version of the index.
The index version depends on the version of mongod that created the index. Before version 2.0 of MongoDB, the this value was 0; versions 2.0 and later use version 1.
Contains a document holding the keys held in the index, and the order of the index. Indexes may be either descending or ascending order. A value of negative one (e.g. -1) indicates an index sorted in descending order while a positive value (e.g. 1) indicates an index sorted in an ascending order.
The namespace context for the index.
A unique name for the index comprised of the field names and orders of all keys.