-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: Query
-
Minor Change
In order to be closer to the native database behavior, Mongoid::Contextual::Aggregable::Memory should ignore nil and non-numeric values.
Suggest to use a lazy map like so:
def aggregable_values self.lazy .map{ |doc| doc.public_send(field) } .select{ |val| val && val.is_a?(Numeric) } end