title: How to check if a field in MongoDB is [] or {}?
body: <p>MongoDB. One of the fields of a document can be either an array, including an empty array, a subdocument, that can be empty or not, or null, or not exist at all. I need a condition for find() that will match a non-empty subdocument, and only that. </p>
  
  <p>So:</p>
  
  <pre><code>fieldName: {} - no match.
  fieldName: [ { id:0 } ] - no match.
  fieldName: [ {} ] - no match.
  No field called fieldName - no match.
  fieldName: null - no match.
  fieldName: { id: 0 } - match.
  </code></pre>
  
  <p>I have no rights to modify anything, I have to work with the database as is. How to formulate that find() ?</p>