【发布时间】:2017-07-17 19:46:13
【问题描述】:
我收集了大约 2 000 000 个文档。
字段unit 具有索引:{"unit" : 1.0}
查询:
db.getCollection('CollectionName').find({"unit":"value"}).count()
执行 5 秒(结果 200 000 个文档)
查询:
db.getCollection('CollectionName').find({"unit":"value"})
执行 0.005 秒
为什么?
【问题讨论】: