title: Aggregate in MongoDB excluding array item
body: <p>I need to group these docs by taxonomy array but I've to exclude from group the "term3" item from the first Doc. (My situation is more complicated in a real app but this example fits.)</p>
  
  <pre><code>[
      {
          "_id": "1",
          "Taxonomy": [
              {
                  "Key": "1", "Term": "term1"
              },
              {
                  "Key": "2", "Term": "term2"
              },
              {
                  "Key": "3", "Term": "term3"
              }
          ]
      },
      {
          "_id": "2",
          "Taxonomy": [
              {
                  "Key": "1", "Term": "term1"
              },
              {
                  "Key": "2", "Term": "term2"
              }
          ]
      },
      {
          "_id": "3",
          "Taxonomy": [
              {
                  "Key": "1", "Term": "term1"
              },
              {
                  "Key": "2", "Term": "term2"
              }
          ]
      }
  ]
  </code></pre>
  
  <p>This command generates two nodes due to the "term3" item:</p>
  
  <pre><code>{$group: {"_id" :"$Taxonomy","Posts" : { "$addToSet" : { "_id" : "$_id"}}}}
  </code></pre>
  
  <p>It is possible to <code>unwind</code>, <code>match</code> and then re-group documents or there is a simple way?</p>