Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a query with AND condition in mongoid

How can I make a query with AND condition in Mongoid?

like image 617
hyperrjas Avatar asked Dec 04 '22 16:12

hyperrjas


1 Answers

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
like image 181
Travis Avatar answered Dec 17 '22 16:12

Travis