title: Type error cannot set property of undefined
body: <p>I am developing app using Nodejs and Mongodb and mongoose. user and Subscriptions are 2 mongoose schemas. I want to get each members expire date from subscriptions collection and include it with each of members object array. But it is not working.</p>
  
  <pre><code>var UserSchema = new Schema({
      title: {
          type: String
      },
      firstName: {
          type: String
      },
      lastName: {
          type: String
      },
      displayName: {
          type: String
      },
  
  });
  
  var SubscriptionSchema = new Schema({
      member_id: {
          type: Schema.ObjectId,
          ref: 'User'
  },
      renewal_date: {
          type: Date
      },
      expire_date: {
          type: Date
  
      },
  
      amount: {
          type: String
      },
      paid_mode: {
          type: String
      },
  
  });
  
  
  
  
  
  exports.memberlist = function(req, res) {
      var expire='';
  
      user.find({}).lean().exec(function(err, collection) {
  
  
  
              var i;
              for(i=0;i&lt;collection.length; i++)
              {
  
  
  
                   Subscriptions.find({'member_id':collection[i]._id}).lean().exec(function(err, subs){
  
                      if(subs.length &gt; 0)
                          {
  
                              expire = subs[0].expire_date || '';
                          collection[i].expire_date = 'expire';
  
                          }
  
  
                     });
  
  
               }
  
  
          res.send(collection);
  
      });
  
  };
  </code></pre>