lib/mongoose/paginate.js
function handleCallback(query, q, model, resultsPerPage, callback) {
  return async.parallel({
    results: function(callback) {
      query.exec(callback);
    },
    count: function(callback) {
      model.count(q, function(err, count) {
        callback(err, count);
      });
    }
  }, function(error, data) {
    if (error) {
      return callback(error);
    }
    callback(null, data.results, Math.ceil(data.count / resultsPerPage) || 1, data.count);
  });
}
function handleCallback(query, q, model, resultsPerPage, callback) {
  return async.parallel({
    results: function(callback) {
      query.exec(callback);
    },
    count: function(callback) {
      model.count(q, function(err, count) {
        callback(err, count);
      });
    }
  }, function(error, data) {
    if (error) {
      return callback(error);
    }
    callback(null, data.results, Math.ceil(data.count / resultsPerPage) || 1, data.count);
  });
}
function handleCallback ( query , q , model , resultsPerPage , callback ) { return async . parallel ( { results : function ( callback ) { query . exec ( callback ) ; } , count : function ( callback ) { model . count ( q , function ( err , count ) { callback ( err , count ) ; } ) ; } } , function ( error , data ) { if ( error ) { return callback ( error ) ; } callback ( null , data . results , Math . ceil ( data . count / resultsPerPage ) || 1 , data . count ) ; } ) ; }
Call callback function passed with results

@method handleCallback
@param {Object} query - mongoose query object
@param {Object} q - query
@param {Object} model - mongoose model
@param {Number} resultsPerPage
@param {Function} callback
@returns {void}
Call callback function passed with results