Method: Mongoid::Criterion::Inclusion#any_of
- Defined in:
- lib/mongoid/criterion/inclusion.rb
#any_of(*args) ⇒ Criteria Also known as: or
Adds a criterion to the Criteria
that specifies a set of expressions to match if any of them return true. This is a $or query in MongoDB and is similar to a SQL OR. This is named #any_of and aliased “or” for readability.
89 90 91 92 93 94 95 96 |
# File 'lib/mongoid/criterion/inclusion.rb', line 89 def any_of(*args) clone.tap do |crit| criterion = @selector["$or"] || [] converted = BSON::ObjectId.convert(klass, args.flatten) = converted.collect { |hash| hash. } crit.selector["$or"] = criterion.concat() end end |