发布于 2015-09-14 15:12:09 | 125 次阅读 | 评论: 0 | 来源: 网络整理
-
db.collection.createIndex(keys, options)
1.8 版后已移除.
参数: |
- keys (document) – A document that contains
pairs with the name of the field or
fields to index and order of the index. A
1 specifies ascending and a -1
specifies descending.
- options (document) – A document that controls the creation
of the index. This argument is optional.
|
The ensureIndex() method is the preferred
way to create indexes on collections.