title: Question regarding chaining multiple any_of criteria #Mongoid
body: <p>I have a requirement where I need to run a MongoDB query like the following: </p>
  
  <pre>db.collection.find({ $or : [{"field1" : "value1"}, {"field2" : "value2"}], 
  $or : [{"field3" : "value3"}, {"field4" : "value4"}]}) 
  </pre>
  
  <p>i.e. </p>
  
  <pre>
  (field1 == value 1 or field2 == value2) and (field3 == value3 or field4 
  == value4) 
  </pre>
  
  <p>I want to achieve this through criteria chaining because the query gets formed 
  dynamically from different parts of the code. But if I try doing something like the following </p>
  
  <pre>
  criteria = Collection.any_of({"field1" => "value1"}, {"field2" => 
  "value2"})
  criteria = criteria.any_of({"field3" => "value3"}, {"field4" => "value4"}) 
  </pre>
  
  <p>I get the resultant query where all these are combined into a single $or 
  statement like </p>
  
  <pre>
  db.collection.find({ $or : [{"field1" : "value1"}, {"field2" : "value2"}, 
  {"field3" : "value3"}, {"field4" : "value4"}]}) 
  </pre>
  
  <p>What is the way to achieve "and" of the two "any_of" using criteria chaining?</p>