title: Waiting for meteor cursor in method
body: <p>I have a large aggrogate query that required me to pass "allowDiskUse: true" as an option.  This would not work with the aggegate as described here:
  <a href="https://github.com/meteorhacks/meteor-aggregate/issues/11" rel="nofollow noreferrer">https://github.com/meteorhacks/meteor-aggregate/issues/11</a></p>
  
  <p>My meteor method is defined here.  When I call the method I need to wait for ondata to complete before anything is returned to the client, but nothing I try allows me to get that data in a safe way up to the front end. </p>
  
  <pre><code>Meteor.methods({
    'getSummary': function (dept,startDate,endDate,filterType) {
  
           f = myQuery(startdate,enddate,dayFinalGroup);   
          f.on("data", Meteor.bindEnvironment(function(row) {
  //load an array or something here to return
              }));
              f.once("end", Meteor.bindEnvironment(function() {
                  // tidy up, in my case end the stream
  
              }));
  
  
      //here I'd return the array loaded
  
    },
  
  });
  </code></pre>
  
  <p>This is my front end.</p>
  
  <pre><code>Meteor.call(
      'getSummary',0,Session.get('start_date'),Session.get('end_date'),1,
      function(error, result){
          if(error){
              console.log(error);
          } else {        
                  Session.set('sumTotals',result);
          }
      }
      );
  </code></pre>