Best way to get a count of server side collection

I’m trying to create a pagination system on a blog I’m implementing with Meteor.

It uses a simple paging system where the user is supposed to click Older or Newer post buttons to cycle the subscribed record sets. In order for the client to know whether or not to continue to display the Older Posts button (if it gets to the end of the list, say), I need a count of all the posts in the serverside collection (or those that match a tag) to compare against my current paging position.

My first thought was to run a Meteor.method defined server side only, since I don’t want a count on the client returning the count of its subscribed record set.

// ./server/methods.js

  postCount: function (tag) {
    var queryObject = {};
    if (tag) {
      check(tag, String);
      queryObject = { tags: tag };

    return Posts.find(queryObject).count();

On the server, this method works fine and returns the expected value. However, I’m having trouble getting data out of it client side – I keep getting back undefined. This is probably some async thing I’m doing wrong…

// ./templates/posts/postsList.js

  // ...
  olderPosts: () => {
    return'postCount', function(err, count) {
      if (err) {
        return false;
      console.log("count: ", count);
      return count > 0;
  // ...

Am I doing this right? If not, can anyone suggest a better way?

Take a look at the tmeasday:publish-counts package.