title: How should I properly use populate with mongoose?
body: <p>I am learning some node and have been trying to use mongoose. Currently, my goal is to learn how to use <a href="http://mongoosejs.com/docs/populate.html" rel="nofollow">populate</a>.</p>
  
  <p>I have a <code>projects</code> definition and <code>milestone</code> require:</p>
  
  <pre><code>projectSchema = new mongoose.Schema({
      id: String,
      title: String,
      description: String,
      owner: String,
      site: String,
      creation_date: Date,
      milestone_ids: Array,
      milestones: [{
          type: mongoose.Schema.Types.ObjectId,
          ref: "Milestone"
      }]
  })
  
  Project = mongoose.model("Project", projectSchema)
  milestones = require(__dirname + "/milestones.js")();
  </code></pre>
  
  <p>Then I do this at some point in the <code>projects.js</code>:</p>
  
  <pre><code>Project.find(query, {}, {sort: {_id: -1}},
      function (error, results) {
          callback(results);
      }
  ).populate("milestones");
  </code></pre>
  
  <p>How do I populate the milestones? </p>
  
  <hr>
  
  <p>Here is the <code>project</code> data from mongo:</p>
  
  <pre><code>{
      "title": "sitename",
      "description": "online thing",
      "creation_date": {
          "$date": "2013-07-11T19:45:42.139Z"
      },
      "_id": {
          "$oid": "51df0b66dbdd7c4f14000001"
      },
      "milestones": [],
      "milestone_ids": [],
      "__v": 0
  }
  </code></pre>
  
  <p>And this one is the <code>milestone</code> that is basically connected to the project:</p>
  
  <pre><code>{
      "title": "Proof of concept",
      "description": "Make it work.",
      "due_date": {
          "$date": "2013-07-11T19:46:38.535Z"
      },
      "project_id": "51df0b66dbdd7c4f14000001",
      "_id": {
          "$oid": "51df0b9edbdd7c4f14000002"
      },
      "__v": 0
  }
  </code></pre>
  
  <p>Also, this is the milestone schema: </p>
  
  <pre><code>milestoneschema = new mongoose.Schema({
      id: String,
      title: String,
      description: String,
      owner: String,
      site: String,
      due_date: Date,
      project_id: {
          type: String,
          ref: "Project"
      }
  })
  
  Milestone = mongoose.model("Milestone", milestoneschema);
  </code></pre>