I have this query:
User.or( { name: 'John' }, { name: 'Sara' } ).or( { age: 17 }, { age: 18 } ) )
It returns the next Criteria:
#<Mongoid::Criteria
selector: {"enabled"=>true, "$or"=>[{"name"=>"John"}, {"name"=>"Anoun"}, {"age"=>17}. {"age"=>18}]}
options: {}
class: User
embedded: false>
But I want to do 'and' betweend two 'or' that return something like this:
#<Mongoid::Criteria
selector: {"enabled"=>true, "$and"=>[
{"$or"=>[{"name"=>"John"}, {"name"=>"Anoun"}]},
{"$or"=>[{"age"=>17}, {"age"=>18}]}
] }
options: {}
class: User
embedded: false>
How would be the query ?