MongoDb创建索引
MongoDb294
description
在test表下创建字段c的正序索引,提高查询效率
command
db.getCollection('test').createIndex({c:1})
parameter
createIndex(keys) : 在集合上创建索引 keys : { "$**" : 1 }升序索引, { "$**" : -1 降序索引}
result
{ "createdCollectionAutomatically" : false, "numIndexesBefore" : 10, "numIndexesAfter" : 11, "ok" : 1.0 }