-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
In case when there any other sorting conditions in current Criteria scope, Mongoid should not add _id: 1 ordering options, on "first" and "last" calls, because this can cause selection without using indexes, and cause performance degradation on large collections.
Also, I think it will be better use natural ordering instead of just sorting by primary keys, since there no such thing like "first" or "last" record in mongo collections.
- is related to
-
MONGOID-4175 #last on a has_many relation does not return the last element
- Closed