title: Perform union in mongoDB
body: <p>I'm wondering how to perform a kind of union in an aggregate in MongoDB. Let's imaging the following document in a collection (the structure is for the sake of the example) :</p>
  
  <pre><code>{
    linkedIn: {
      people : [
      {
        name : 'Fred'
       },
       {
         name : 'Matilda'
       }
     ]
    },
    twitter: {
      people : [
      {
         name : 'Hanna'
      },
      {
         name : 'Walter'
      }
     ]
    }
   }
  </code></pre>
  
  <p>How to make an aggregate that returns the union of the people in twitter and linkedIn ?</p>
  
  <pre><code>{
   { name :'Fred', source : 'LinkedIn'},
   { name :'Matilda', source : 'LinkedIn'},
   { name :'Hanna', source : 'Twitter'},
   { name :'Walter', source : 'Twitter'},
  }
  </code></pre>