翻译或纠错本页面
- Reference >
- mongo Shell Methods >
- Collection Methods >
- db.collection.createIndex()
db.collection.createIndex()¶
说明¶
- db.collection.createIndex(keys, options)¶
1.8 版后已移除.
在集合中创建索引
Parameter Type Description keys document For each field to index, a key-value pair with the field and the index order: 1 for ascending or -1 for descending. options document Optional. One or more key-value pairs that specify index options. For a list of options, see db.collection.ensureIndex(). 参见
Indexes, db.collection.createIndex(), db.collection.dropIndex(), db.collection.dropIndexes(), db.collection.getIndexes(), db.collection.reIndex(), and db.collection.totalIndexSize()