title: mongodb aggregate and $lookup in the same collection within a subdocument
body: <p>I have the following structure:</p>
  
  <pre><code>{ 
      "_id" : ObjectId("5ae451b46302b274b5ebeefb"), 
      "name" : "Laurent", 
      "email" : "laurent@laurent.fr", 
      "password" : "sha1$e6f05101$1$21444307dfa8684f479f39530b03a2f5cad98ac9", 
      "follows" : [
          {
              "_id" : ObjectId("5ae7495e1cc09532e98b70fc"), 
              "userId" : "5ae4f2dc3d921228f5af56bc"
          }, 
          {
              "_id" : ObjectId("5ae749a31cc09532e98b70fd"), 
              "userId" : "5ae5f100e11ba63941fc0cb6"
          }
      ]
  }
  { 
      "_id" : ObjectId("5ae4f2dc3d921228f5af56bc"), 
      "name" : "Test", 
      "email" : "test@test.com", 
      "password" : "sha1$5155f44b$1$05ff3feef313caf6c3d9e13e44629430368ea812", 
      "follows" : [
          {
              "_id" : ObjectId("5ae591cf3f56d33772540572"), 
              "userId" : "5ae451b46302b274b5ebeefb"
          }
      ]
  }
  { 
      "_id" : ObjectId("5ae5f100e11ba63941fc0cb6"), 
      "name" : "user", 
      "email" : "user@user.com", 
      "password" : "sha1$30af5299$1$7f2fe08a44221b2b03ff0365b51b0b1aa5184da1", 
      "follows" : [
          {
              "_id" : ObjectId("5ae6011a5ccd9b4bcab5f45e"), 
              "userId" : "5ae4f2dc3d921228f5af56bc"
          }, 
          {
              "_id" : ObjectId("5ae60af234591a4fdfedaf02"), 
              "userId" : "5ae451b46302b274b5ebeefb"
          }
      ], 
      "__v" : NumberInt(0)
  }
  </code></pre>
  
  <p>I would like to retrieve the information of the users reffered to in the follows.userId with an aggregate function.</p>
  
  <p>My request is this :</p>
  
  <pre><code>db.users.aggregate(
              {$match: {_id: ObjectId('5ae451b46302b274b5ebeefb')}},
              {$unwind: "$follows"},
              {
                  $lookup: {
                      from: "users",
                      localField: "follows.userId",
                      foreignField: "_id",
                      as: "subscriptions"
                  }
              }
              )
  </code></pre>
  
  <p>I get an empty subscriptions field in the output :</p>
  
  <pre><code>{ 
      "_id" : ObjectId("5ae451b46302b274b5ebeefb"), 
      "name" : "Laurent", 
      "email" : "laurent.chriqui@coding-academy.fr", 
      "password" : "sha1$e6f05101$1$21444307dfa8684f479f39530b03a2f5cad98ac9", 
      "follows" : {
          "_id" : ObjectId("5ae7495e1cc09532e98b70fc"), 
          "userId" : "5ae4f2dc3d921228f5af56bc"
      }, 
      "subscriptions" : [
  
      ]
  }
  { 
      "_id" : ObjectId("5ae451b46302b274b5ebeefb"), 
      "name" : "Laurent", 
      "email" : "laurent@laurent.fr", 
      "password" : "sha1$e6f05101$1$21444307dfa8684f479f39530b03a2f5cad98ac9", 
      "__v" : NumberInt(0), 
      "follows" : {
          "_id" : ObjectId("5ae749a31cc09532e98b70fd"), 
          "userId" : "5ae5f100e11ba63941fc0cb6"
      }, 
      "subscriptions" : [
  
      ]
  }
  </code></pre>
  
  <p>I don't understand why the subscriptions field is an empty array and is not filled with the users information.</p>
  
  <p>Does anyone has any idea of what the problem is and how I could get this to work ?</p>