title: How can I use node async to fetch my mongoose calls?
body: <p>I'm building a site with node/express/mongoose and it needs to do the following things when viewing a submission.</p>
  
  <p>The problem I'm running into is doing db fetches in a non-serial fashion. For example, I'll do a few calls to fetch some data, but some of the calls might not finish until the execution context goes to the other. Tried to use the npm module, async, but am having trouble trying to figure out how I would integrate it.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var getViewCount = function(submissionId) {
    Submission.getSubmissionViewCount({
      submissionId : submissionId
    }, function(err, count) {
      if (err) {
        throw err;
      }
  
      if (count) {
        return count;
      }
    });
  };
  
  var getVotes = function(submissionId) {
    console.log('getvotes');
    Submission.getSubmissionVotes({
      submissionId : submissionId
    }, function(err, votes) {
      return votes;
    });
  };
  
  var getSubmission = function(id) {
    Submission.getSubmission({
      id : id
    }, function(err, submission) {
      if (err) {
        throw err;
      }
  
      if (submission) {
        return submission;
      }
    });
  };
  
  var renderSubmission = function(title, submission, views) {
    res.render('submission', {
        title: submission.title + ' -',
        submission: submission,
        views: views.length
    });
  };
  </code></pre>
  
  <p>How do I use this with async? Or should I be using <code>async.series</code> isntead of <code>async.async</code>?</p>
  
  <pre><code>async.series([
    function(callback) {
      var submission = getSubmission(id);
      callback(null, submission);
    },
    function(callback) {
    //  getViewCount(submissionId);
    },
    function(callback) {
  //    getVotes(submissionId);
    },
    function(callback) {
      //renderSubmission(title, submission, views);
    }
    ], function(err, results) {
      console.log(results);
    });
  </code></pre>
  
  <p>Basically I want to fetch the views and votes first and then render my submission.</p>