title: Nodejs + mongodb : How to query $ref fields?
body: <p>I'am using MongoDB with a nodejs REST service which exposes my data stored inside. I have a question about how to interrogate my data which uses $ref.</p>
  
  <p>Here is a sample of an Object which contains a reference to another object (detail) in anther collection :</p>
  
  <pre><code>{
      "_id" : ObjectId("5962c7b53b6a02100a000085"),
      "Title" : "test",
      "detail" : {
          "$ref" : "ObjDetail",
          "$id" : ObjectId("5270c7b11f6a02100a000001")
      },
      "foo" : bar
  }
  </code></pre>
  
  <p>Actually, using Node.js and mongodb module, I do the following :</p>
  
  <pre><code>db.collection("Obj").findOne({"_id" : new ObjectID("5962c7b53b6a02100a000085"},
  function(err, item) {
      db.collection(item.$ref).findOne({"_id" : item.$id}, function(err,subItem){
          ...
      });
  });
  </code></pre>
  
  <p>In fact I make 2 queries, and get 2 objects. It's a kind of "lazy loading" (not exactly but almost)</p>
  
  <p>My question is simple : is it possible to retrieve the whole object graph in one query ?</p>
  
  <p>Thank you</p>