-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: Query
Currently in Mongoid the and, or and nor methods consider the receiver one of the operands. For and this doesn't matter, for or and nor this makes a difference. not does not consider the receiver one of the operands but it has a mode of operation (the argument-less invocation) where it flips the meaning of the next condition, which is essentially action-at-a-distance.
Mongoid provides the any_of method which only considers its arguments its operands, i.e. it adds a disjunction of its operands to the query using 'and'.
(There is also all_of that follows the same naming convention, however it is equivalent to .and in all uses.)
We should add none_of method to Mongoid which will behave as not with arguments, that is, it will have no possibility of altering the meaning of other conditionals and will just act on its direct arguments. This method will be easier for users of Mongoid to use correctly.