title: Mongo+PHP Query How to check if an field is empty
body: <p>Data: </p>
  
  <pre><code>"field1" : { "sub_field" : [ ]}
  </code></pre>
  
  <p>I want to write a query to check if the 'sub_field' is empty or not.</p>
  
  <p>This is what I tried:</p>
  
  <pre><code>$cursor = $collection-&gt;find( array('field1.sub_field' =&gt; array('$ne' =&gt; null))
  </code></pre>
  
  <p>Obviously it gives results as Array is not null (I have tried null and empty space  in futility).</p>
  
  <p>I was told that '$size' operator can be used to achieve this. but I have had no luck so far.</p>
  
  <p>Any suggestions ?</p>