Reputation: 10744
How can I make a query with AND condition in Mongoid?
Upvotes: 4
Views: 5431
Reputation: 889
Also, you can chain things using .and(other_thing:'value')
For instance, Model.where(awesome:true).and(other_thing:true)
Upvotes: 2
Reputation: 10567
You can chain where
statements or include multiple conditions to the where
call.
Model.where(condition_a: :a, condition_b: :b).all
or
Model.where(condition_a: :a).where(condition_b: :b).all
Upvotes: 15