title: Mongoose Relationship Populate Doesn't Return results
body: <pre><code>    var SecuritySchema = new Mongoose.Schema({
          _bids: [{
              type: Mongoose.Schema.Types.ObjectId,
              ref: 'BuyOrder'
          }],
          _asks: [{
              type: Mongoose.Schema.Types.ObjectId,
              ref: 'SellOrder'
          }]
      });
  
      var OrdersSchema = new Mongoose.Schema({
          _security: {
              type: Mongoose.Schema.Types.ObjectId,
              ref: 'Security'
          },
          price: {
              type: Number,
              required: true
          },
          quantity: {
              type: Number,
              required: true
          }
      });
  
  
      // declare seat covers here too
      var models = {
          Security: Mongoose.model('Security', SecuritySchema),
          BuyOrder: Mongoose.model('BuyOrder', OrdersSchema),
          SellOrder: Mongoose.model('SellOrder', OrdersSchema)
      };
      return models;
  </code></pre>
  
  <p>And than when I save a new <code>BuyOrder</code> for example:</p>
  
  <pre><code>// I put the 'id' of the security: order.__security = security._id on the client-side
  var order = new models.BuyOrder(req.body.order);
      order.save(function(err) {
          if (err) return console.log(err);
      });
  </code></pre>
  
  <p>And attempt to re-retrieve the associated security:</p>
  
  <pre><code>models.Security.findById(req.params.id).populate({
          path: '_bids'
      }).exec(function(err, security) {
          // the '_bids' array is empty.
      });
  </code></pre>
  
  <p>I think this is some sort of naming issue, but I'm not sure, I've seen examples <a href="https://stackoverflow.com/questions/7810892/node-js-creating-relationships-with-mongoose">here</a> and on the moongoose website that use <code>Number</code> as the <code>Id</code> type: <a href="http://mongoosejs.com/docs/populate.html" rel="nofollow noreferrer">http://mongoosejs.com/docs/populate.html</a></p>