title: Access the data from reference document in mongodb
body: <p>I have the user collection like</p>
  
  <pre><code>{
      "_id" : "xyz@xyz.com",
      "name" : "First Last",
      "permission" : ObjectId("5bf4e199e2a30916d6eaeb8c")
  }
  {
      "_id" : "abc@xyz.com",
      "name" : "Name Last",
      "permission" : ObjectId("5bf4e199e2a30916d6eaeb8c")
  }
  </code></pre>
  
  <p>permission is the reference field, part of another collection Permission.
  Permission collection is like</p>
  
  <pre><code>{
      "_id" : ObjectId("5bf4e199e2a30916d6eaeb8c"),
      "name" : "Admin"
  }
  {
      "_id" : ObjectId("5548e199e2a30916d6kj7856"),
      "name" : "Super Admin"
  }
  </code></pre>
  
  <p>I am fetching the data from user collection using aggregate like</p>
  
  <pre><code>    db.user.aggregate([{'$project': {
          '_id' : 1,
          'name' : "$name",
          'permission' : "$permission.name"
          } 
      }])
  </code></pre>
  
  <p>I want to get the content of name from permission collection.
  Output is </p>
  
  <pre><code>{'name': 'First Last', 'user_company': 'abc', '_id': 'xyz@xyz.com'}
  {'name': 'Last Name', 'user_company': 'NEW COMPANY', '_id': 'abc@abc.com'}
  </code></pre>
  
  <p>It should be like</p>
  
  <pre><code>{'name': 'First Last', 'user_company': 'abc', '_id': 'xyz@xyz.com', permission : "Admin"}
  {'name': 'Last Name', 'user_company': 'NEW COMPANY', '_id': 
  'abc@abc.com', 'permission' : "Super Admin"
  }
  </code></pre>
  
  <p>How to get the result ?</p>