title: Using the .find().fetch() from within a function in Meteor
body: <p>I am making a project with Meteor and I'm having some issues trying to get data out of mongodb in JavaScript. I have the following in a function:</p>
  
  <p><code>console.log(Time.find({today: "Saturday"}).fetch());</code></p>
  
  <p>In my publish.js file on the server side I have the following:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>Meteor.publish("time", function () {
    var currentUserId = this.userId;
    return Time.find({user: currentUserId});
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>And In my subscriptions file I have the following:</p>
  
  <p><code>Meteor.subscribe("time");</code></p>
  
  <p>This function gets called later down in the code but it returns an empty array. If I run this code in my browsers console it returns an array with 2 objects in it, which is correct. This leads me wondering if I can use the .fetch() function from within my code? As if I leave off the .fetch() it returns what looks like the usual giant object. My real problem is I need the data in the form that .fetch() gives it to me in. I think it's because the function gets triggered before the data gets a chance to load in, as if I switch out the .fetch() for a .count() it returns 0.</p>
  
  <p>Is there any way around this or a fix?</p>