为了提高查询效率,MongoDB中也支持索引
# 查看索引 db.user.getIndexes() # 创建索引 db.user.createIndex({'age':1})
注意事项: 1:升序索引 -1:降序索引