title: Filter documents by field value in array, Mongodb
body: <p>Collection:</p>
  
  <pre><code>[{
      _id: 'Foo',
      plugs: [
          { type: 'CE', code: 12 },
          { type: 'SH': code: 34 }
      ]
  },{
      _id: 'Bar',
      plugs: [
          { type: 'T2', code: 23 },
          { type: 'T2': code: 43 }
      ]
  }]
  </code></pre>
  
  <p>In the plug array may be entries with the same type. When I make an aggregation I want to filter the documents by type of plugs. E.g. return only documents that contains a plug of type T2. How can I do that in mongodb? I am aware of the $in query but this only works for a simple array of values.</p>