title: MongoDB $lookup result as object instead of array
body: <p>Table "user":</p>
  
  <pre><code>{
      "_id" : ObjectId("573b09e6322304d5e7c6256e"),
      "name" : "John",
      "age" : 30,
      "list" : [ 
          "userId1", 
          "userId2", 
          "userId3", 
          "userId2"
      ]
  },
  {
      "_id" : "userId1",
      "name" : "Derek",
      "age" : 34
  },
  {
      "_id" : "userId2",
      "name" : "Homer",
      "age" : 44
  },
  {
      "_id" : "userId3",
      "name" : "Bobby",
      "age" : 12
  }
  </code></pre>
  
  <p>My query:</p>
  
  <pre><code>db.user.aggregate(
      [
          {
              $match: { "_id": ObjectId("573b09e6322304d5e7c6256e") }
          },
          {
              $lookup:
              {
                  from: "user",
                  localField: "list",
                  foreignField: "_id",
                  as: "listData"
              }
          }
      ]
  )
  </code></pre>
  
  <p>I need to findOne user by id with joined list data as id/value object:</p>
  
  <pre><code>{
      "_id" : ObjectId("573b09e6322304d5e7c6256e"),
      "name" : "John",
      "age" : 30,
      "list" : [ 
          "userId1", 
          "userId2", 
          "userId3", 
          "userId2"
      ],
      "listData" : {
          "userId1": {
              "_id" : "userId1",
              "name" : "Derek",
              "age" : 34
          }, 
          "userId2": {
              "_id" : "userId2",
              "name" : "Homer",
              "age" : 44
          }, 
          "userId3": {
              "_id" : "userId3",
              "name" : "Bobby",
              "age" : 12
          }
      ]
  }
  </code></pre>
  
  <p>But I got listData as array:</p>
  
  <pre><code>{
      "_id" : ObjectId("573b09e6322304d5e7c6256e"),
      "name" : "John",
      "age" : 30,
      "list" : [ 
          "userId1", 
          "userId2", 
          "userId3", 
          "userId2"
      ],
      "listData" : [ 
          {
              "_id" : "userId1",
              "name" : "Derek",
              "age" : 34
          }, 
          {
              "_id" : "userId2",
              "name" : "Homer",
              "age" : 44
          }, 
          {
              "_id" : "userId3",
              "name" : "Bobby",
              "age" : 12
          }
      ]
  }
  </code></pre>
  
  <p>What i need to change to get array as object with keys as ids? db version v4.0.2</p>