-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Query
-
Major Change
After MONGOID-4547 is implemented, the :id_sort option on first/last should be deprecated (and dropped support for later), and any unsorted taking of documents should use the #take method.
This ticket is for deprecating in 7.5 and removing support for in 8.0 the id_sort option.
This ticket will also be used to investigate our current implementation of the limit option, document it, and verify that it's not subject to the same errors the id_sort method was. If necessary, this option can be implemented here as well.
------
#first and #last methods on associations/enumerations are defined in several classes/modules in Mongoid, and are also used from several call sites. It appears that not all method definitions support the same signature that Mongoid itself uses elsewhere. While this may not be an issue for what Mongoid does internally, users that perform the set of operations that Mongoid does generally support on all of the associations/enumerables may run into problems when the call tree path they end up constructing results in Mongoid passing first/last arguments to implementations that don't recognize the arguments.
For this ticket, all internal uses of first/last by Mongoid should agree on the expected signature.
Original report:
In this commit arguments was added in Mongoid::Contextual::Mongo#first and Mongoid::Contextual::Mongo#last. We can't pass arguments in other contexts, like Mongoid::Contextual::None#first.
In this other commit, arguments was added in Mongoid::Contextual::Memory#first but not in Mongoid::Contextual::Memory#last.
For consistency, is it better to allow arguments for last and first in every context?
- has to be done before
-
MONGOID-5416 Mongoid::Contextual#last modifies the sort on the view
- Closed
-
MONGOID-5419 Add warnings to the new Mongoid::Warnings module
- Closed
- is related to
-
MONGOID-5546 First/Last failures when empty hash passed as criteria
- Closed
-
MONGOID-4547 Implement #take / #take! for AR feature parity
- Closed