发布于 2015-09-14 15:01:48 | 210 次阅读 | 评论: 0 | 来源: 网络整理

db.collection.getIndexes()

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:

system.indexes.v

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.

system.indexes.key

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.

system.indexes.ns

The namespace context for the index.

system.indexes.name

A unique name for the index comprised of the field names and orders of all keys.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务