title: $lookup and $match Mongodb golang
body: <p>I want to get document with foreign key by using $lookup and $match on MongoDB.</p>
  
  <p>There is a "Jobs" collection which stores Job document. In Job document there are two field using as foreing key "creatorParent" and "Children".
  CreatorParent is a foreign key for "Users" collection and Children array contains id for user's children.</p>
  
  <p>When I list the whole jobs, I want to retrieve detail from "Users" collection for both CreatorParent ID and ChildrenID. I want to marshall "Job" document with ParentDetail and ChildDetail. I don't want to write a custom method for that. Is it possible to handle it with MongoDB query?</p>
  
  <p><strong>By the way I'm beginner on MongoDB so should store needed details on Children and CreatorParent instead of storing ObjectId?</strong></p>
  
  <p><a href="https://i.stack.imgur.com/FMh99.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FMh99.png" alt="Jobs Collection"></a></p>
  
  <p><a href="https://i.stack.imgur.com/Rle13.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rle13.png" alt="Users Collection"></a></p>
  
  <p>Users document:</p>
  
  <pre><code>{
      "_id" : ObjectId("58daf84877733645eaa9b44f"),
      "email" : "meto93@gmail.com",
      "password" : "vpGl+Fjnef616cRgNbCkwaFDpSI=",
      "passwordsalt" : "99397F4A9D3A499D96694547667E74595CE994D2E83345D6953EF866303E8B65",
      "children" : [ 
          {
              "_id" : ObjectId("58daf84977733645eaa9b450"),
              "name" : "Mert",
              "age" : 5,
              "additionalinformation" : "ilk cocuk",
              "creationtime" : ISODate("2017-03-28T23:56:56.952Z"),
              "userid" : ObjectId("58daf84877733645eaa9b44f"),
              "gender" : null
          }, 
          {
              "_id" : ObjectId("58daf84977733645eaa9b451"),
              "name" : "Sencer",
              "age" : 7,
              "additionalinformation" : "ikinci cocuk",
              "creationtime" : ISODate("2017-03-28T23:56:56.952Z"),
              "userid" : ObjectId("58daf84877733645eaa9b44f"),
              "gender" : null
          }
      ]
  }
  </code></pre>
  
  <p>Job</p>
  
  <pre><code>{
      "_id" : ObjectId("58db0a2d77733645eaa9b453"),
      "creationtime" : ISODate("2017-03-29T01:13:17.509Z"),
      "startingtime" : ISODate("2017-04-03T13:00:00.000Z"),
      "endingtime" : ISODate("2017-04-03T17:00:00.000Z"),
      "children" : [ 
          ObjectId("58daf84977733645eaa9b450"), 
          ObjectId("58daf84977733645eaa9b451")
      ],
      "creatorparent" : ObjectId("58daf84877733645eaa9b44f"),
      "applicants" : []
  }
  </code></pre>