Method: Mongoid::Criterion::Inclusion#and
- Defined in:
- lib/mongoid/criterion/inclusion.rb
#and(selector = nil) ⇒ Object
Adds a criterion to the Criteria that specifies values that must be matched in order to return results. This is similar to a SQL “WHERE” clause. This is the actual selector that will be provided to MongoDB, similar to the Javascript object that is used when performing a find() in the MongoDB console.
Options:
selectior: A Hash that must match the attributes of the Document.
Example:
criteria.and(:field1 => "value1", :field2 => 15)
Returns: self
41 42 43 |
# File 'lib/mongoid/criterion/inclusion.rb', line 41 def and(selector = nil) where(selector) end |