title: TypeError: undefined is not a function in node.js / express.js
body: <p>I got the following error: TypeError: undefined is not a function</p>
  
  <p>callback(null, array_reply, threadResults);</p>
  
  <p>this part seems bad but I don't know why.</p>
  
  <p>I need your help. thanks</p>
  
  <pre><code>async.waterfall([
      function (callback) {
          Model.find()
          .limit(10)
          .sort({pushed_date: 'desc'})
          .exec( function (err, results) {
              if (err) {
                  log('Error: ' + err.message);
                  callback(err);
                  return;
              }
              var array_reply = new Array();
  
              async.forEachSeries(results,
              function (result, callback) {
                  var reply = result.replies[result.replies_count];
                  array_reply.push(reply);
              },callback);
              callback(null, array_reply);
          });
      },
      function (array_reply, callback) {
          Model.find()
          .limit(10)
          .sort( {replies_count: 'desc'} )
          .exec( function (err, results) {
              if (err) {
                  callback(err);
                  return;
              }
              callback(null, array_reply, results);
          });
      }
  ], function (err, array_reply, results) {
      if (err) {
          console.error("Error!");
          return next(err);
      }
      res.render("aaa.hbs",{
          models: results,
          posts: array_reply
      });
  })
  </code></pre>
  
  <p>I changed my source like this.</p>
  
  <pre><code>async.waterfall([
      function (callback) {
          Model.find()
          .limit(10)
          .sort({pushed_date: 'desc'})
          .exec( function (err, results) {
              if (err) {
                  log('Error: ' + err.message);
                  callback(err);
                  return;
              }
              var array_reply = new Array();
  
              async.forEachSeries(results,
              function (result, callback) {
                  var reply = result.replies[result.replies_count];
                  array_reply.push(reply);
              },callback);
              callback(null, array_reply);
          });
      },
      function (array_reply, callback) {
          Model.find()
          .limit(10)
          .sort( {replies_count: 'desc'} )
          .exec( function (err, results) {
              if (err) {
                  callback(err);
                  return;
              }
             if (results.length &gt; 0) {
                  res.render("aaa.hbs",{
                      models: results,
                      posts: array_reply
                  });
              } else {
                  res.render("aaa.hbs",{
                      models: null,
                      posts: array_reply
                  });
              }
          });
      }
  ], function (err) {
      if (err) {
          console.error("Error!");
          return next(err);
      }
  })
  </code></pre>