title: aggregate mongodb result agroup
body: <p>Someone with me I'm a light, I'm not welcome.</p>
  
  <p>I do not know if I would have to do this adjustment with a group</p>
  
  <pre><code>db.users.aggregate([
          { $match : {  '_id': ObjectId('5956a6361b9f673dc629c9a6') } },
          { '$unwind': { 'path': '$profile', 'preserveNullAndEmptyArrays': true } },
          {$lookup: {
                  'from': 'institution',
                  'localField': 'profile.departament',
                  'foreignField': 'departament._id',
                  'as': 'Institution'
              }   
          },
          { '$unwind': { 'path': '$Institution', 'preserveNullAndEmptyArrays': true } },
  
          {$project: {
            'Profile':{
                  'name' : '$name',
                  'photo': '$photo',
                  'nickname' : '$nickname',
                  'institution' : {name: '$Institution.name', photo: '$Institution.photo'},        
                  'departments' : {title : '$Institution.departament.title', category: '$Institution.departament.category'} ,
               }
             }
          },
  
          { $group : {
                '_id' : '$_id', 
                'profile': { $push : '$Profile' },
  
              }
          },
  
  
  
  
      ])
  </code></pre>
  
  <p>I can not do the group 'institution' o result it is like this</p>
  
  <pre><code>"departments" : {
              "title" : [
                  "Terror by africa", 
                  "Africa"
              ], 
              "category" : [
                  "Sub-15", 
                  "Sub-20"
              ]
          }
  </code></pre>
  
  <p>As I'm trying to let not have to use array position</p>
  
  <pre><code>"departments" : {
              "title" : [{
                  name: "Terror by africa", 
                  category: "Sub-15", 
              },{
                  name: "Africa", 
                  category: "Sub-20", 
              }], 
  
          }
  </code></pre>