-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
ALL
I have a collection with 2m records. unique index on _id and foo columns
db.col.aggregate([ { "$match" : { "foo" : "abcd" } }, { "$sort" : { "_id" : 1 } } ])
takes about 5 seconds to return;
db.col.aggregate([ { "$match" : { "foo" : "abcd" } } ])
returns instantly. An explain shows that the first one chooses to use the _id index for some reason therefore causing a whole table scan. I seem to recall this also being an issue back in mongo 2.4 but is still there in mongo 3
- duplicates
-
SERVER-7568 Aggregation framework favors non-blocking sorts
- Closed
- is related to
-
SERVER-21502 $group using index
- Closed