Mongodb Aggregation Framework:$ group是否使用索引? [英] Mongodb Aggregation Framework: Does $group use index?
问题描述
我正在尝试将聚合框架与$match
和$group
阶段一起使用. $group
阶段是否使用索引数据?我正在使用最新的可用mongodb版本-2.5.4
I'm trying to use aggregation framework with $match
and $group
stages. Does $group
stage use index data? I'm using latest available mongodb version - 2.5.4
推荐答案
$group
不使用索引数据.
从mongoDB docs :
From the mongoDB docs:
$ match和$ sort管道运算符可以在索引出现在管道开头时加以利用.
The $match and $sort pipeline operators can take advantage of an index when they occur at the beginning of the pipeline.
$ geoNear管道运算符利用地理空间索引. 使用$ geoNear时,$ geoNear管道操作必须显示为 聚合管道的第一阶段.
The $geoNear pipeline operator takes advantage of a geospatial index. When using $geoNear, the $geoNear pipeline operation must appear as the first stage in an aggregation pipeline.
这篇关于Mongodb Aggregation Framework:$ group是否使用索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!