title: Waiting for meteor collection to finish before next step
body: <p>I have a Meteor  template that should be displaying some data. </p>
  
  <pre><code>Template.svg_template.rendered = function () {
    dataset_collection = Pushups.find({},{fields: { date:1, data:1 }}, {sort: {date: -1}}).fetch();
  
    a = moment(dataset_collection[0].date, "YYYY/M/D");
    //more code follows that is also dependent on the collection being completely loaded
  };
  </code></pre>
  
  <p>Sometimes it works, sometimes I get this error:</p>
  
  <p>Exception from Deps afterFlush function: TypeError: Cannot read property 'date' of undefined</p>
  
  <p>I'm not using Deps in any context.  As I understand it, the collection is being referenced before it is completely finished loading.  </p>
  
  <p>I therefore would like to figure out how to simply say "wait until the collection is found before moving on."   Should be straightforward, but can't find an updated solution.  </p>