It appears that when calling a .sum query such as:
shop.rooms.order(room_number: 1).sum(:capacity)
In Mongoid 3.0, this would ignore any sort condition
In Mongoid 7.0 it includes the sort condition in the query
Since .sum (and related methods) should be completely sort agnostic (the sum is the same no matter how you sort), I think the correct behavior should be to ignore the sort as per Mongoid 3.0. This causes strange behavior when using sorting in default_scope, for example.
- related to
-
RUBY-2565 skip/limit not respected by count
- Closed