title: MongoDB 3.4 MongoDBRef dereferencing with .NET MongoDB Driver
body: <p>I have following collections:
  Collection A</p>
  
  <pre><code>{
      "_id" : ObjectId("5aaa3b170e26ed1eba223ba9"),
      "name" : "A1",
      "ref" : {
          "$ref" : "B",
          "$id" : ObjectId("5aaa33740e26ed1eba223ba1")
      }
  }
  {
      "_id" : ObjectId("5aaa3b170e26ed1eba223baa"),
      "name" : "A2",
      "ref" : {
          "$ref" : "C",
          "$id" : ObjectId("5aaa33740e26ed1eba223ba2")
      }
  }
  </code></pre>
  
  <p>Collection B</p>
  
  <pre><code>{
      "_id" : ObjectId("5aaa33740e26ed1eba223ba1"),
      "name" : "B1"
  }
  ...
  </code></pre>
  
  <p>Collection C</p>
  
  <pre><code>{
         "_id" : ObjectId("5aaa33740e26ed1eba223ba2"),
         "name" : "C1"
  }
  ...
  </code></pre>
  
  <p>It is posable to get folowing result?</p>
  
  <pre><code>{
      "_id" : ObjectId("5aaa3b170e26ed1eba223ba9"),
      "name" : "A1",
      "result" : [ 
          {
              "name" : "B1"
          }
      ]
  }
  {
      "_id" : ObjectId("5aaa3b170e26ed1eba223baa"),
      "name" : "A2",
      "result" : [ 
          {
              "name" : "C1"
          }
      ]
  }
  </code></pre>
  
  <p>I tried it with $Project and §Lookups, unfortunately withou success.
  Hire is example:</p>
  
  <pre><code>db.A.aggregate([
    {$project: { 
      name : 1,
      refId: {$arrayElemAt: [{$objectToArray:"$ref"},1]},
      refCol: {$arrayElemAt: [{$objectToArray:"$ref"},0]},
    }
  },
    {$lookup : {
       from : "refCol.v",
       localField : "refId.v",
       foreignField : "_id",
       as : "result"
       }
    },
    {$project : {"result._id" : 0, refId : 0, refCol : 0}} 
  ])
  </code></pre>
  
  <p>In this example I can't reference the "refCol.v" field in the $lookup function.
  Have someone a tip or a better solution for me?</p>