PHP MongoDB find with multiple "AND" conditions?
<p>After hours of experimentations and readings, I cannot find a solution to this problem: </p>

<p>I want to do a <code>MongoDB-&gt;find($query)</code> with multiple AND conditions.</p>

<p>For instance, say I want id = 5 and a &lt; 6 and a > 2 and b > 10 and b &lt; 20</p>

<p>I was expecting $query to be: </p>

<pre><code>$query = array("id" =&gt; 5,
   "a" =&gt; array('$gt' =&gt; 2,  
           '$lt' =&gt; 6),
   "b" =&gt; array('$gt' =&gt; 10,
           '$lt' =&gt; 20))
</code></pre>

<p>But this returns empty results with my DB</p>

<p>I tried various syntaxes such as:</p>

<pre><code>$query = array("id" =&gt; 5,
          array( "a" =&gt; array('$gt' =&gt; 2,
              '$lt' =&gt; 6),
       "b" =&gt; array('$gt' =&gt; 10,
             '$lt' =&gt; 20)))
</code></pre>

<p>But this fails too.</p>

<p>Also tried with <code>"$AND"</code> variants, no luck.</p>

<p>Is it possible to "mix" several <code>AND</code> conditions in PHP-MongoDB <code>find()</code> requests?</p>