title: Mongodb aggregate lookup for many collections to one nested output
body: <p>I've 3 Collections:</p>
  
  <p>School</p>
  
  <pre><code>{   "id" : { "$numberLong" : "100000" },         
      "name" : "School1" }
  </code></pre>
  
  <p>Faculty</p>
  
  <pre><code>{   "id" : { "$numberLong" : "100000" }, 
      "schoolId" : { "$numberLong" : "100000" }, 
      "name" : "Faculty1" }
  </code></pre>
  
  <p>Subject</p>
  
  <pre><code>{   "id" : { "$numberLong" : "100000" },       
      "name" : "Subject1" }
  </code></pre>
  
  <p>Assume there are many of these in each collection. I want to be able to serve an endpoint that takes in an ID and returns the full 3 layered heirarchy (School->Faculty->Subject). How would I return all this data. </p>
  
  <p>Something like:</p>
  
  <pre><code>{
      id: 1,
      name: "school1", 
      faculties: [{
          id:1000, 
          name: "faculty1", 
          subjects: [
              {id: 1, name: "sub1"},
              {id: 2, name: "sub2"},
              {id: 3, name: "sub3"}
          ]
      }]
  }
  </code></pre>