title: Mongoose find element in array
body: <p>I just started with Mongoose and having issues finding elements...</p>
  
  <p>My schema contains an array of <code>subregions</code> from which I want to find the matching one by its <code>code</code>. The schema is the following:</p>
  
  <pre><code> var schema = {
          name: {
              type: String,
              required: true
          }
  
          ...
  
          subRegions: [{
              name: {
                  type: String,
                  required: true
              },
              code: {
                  type: String,
                  required: true
              }
          }]
  
          ...
  
      };
  </code></pre>
  
  <p>I came up with </p>
  
  <pre><code>find({
      subRegions: {
          "$in": [{
              code: regionCode
          }]
      }
  }).exec(...)
  </code></pre>
  
  <p>but this is not working...</p>