Method: Mongoid::Criterion::Inclusion#all
- Defined in:
- lib/mongoid/criterion/inclusion.rb
#all(attributes = {}) ⇒ Object
Adds a criterion to the Criteria that specifies values that must all be matched in order to return results. Similar to an “in” clause but the underlying conditional logic is an “AND” and not an “OR”. The MongoDB conditional operator that will be used is “$all”.
Options:
attributes: A Hash where the key is the field name and the value is an Array of values that must all match.
Example:
criteria.all(:field => ["value1", "value2"])
criteria.all(:field1 => ["value1", "value2"], :field2 => ["value1"])
Returns: self
22 23 24 |
# File 'lib/mongoid/criterion/inclusion.rb', line 22 def all(attributes = {}) update_selector(attributes, "$all") end |