-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Minor Change
When calling #last on a context, the view within the context is modified to have the reverse _id sorting. The same is not true in #first, and I think this should be changed.
This is causing calling #first after #last to behave unexpectedly:
context.first # first doc context.last # last doc context.first # last doc
Additionally #last attempts to get the sort from the criteria, and not from the view, like first does. I think this should be made consistent. Note that when creating a context from a criteria that has a sort, the sort is also transferred to the view.
We have two options:
1) change #first to get the sort from the criteria
2) change #last to not modify the view
- has to be done after
-
MONGOID-4998 Make all #first and #last methods have consistent signatures and compatible with Ruby core/AR
- Closed