api/server.js
// async helper function for finding all stats that meet the given query specified in a StatQuery object
async helper function for finding all stats that meet the given query specified in a StatQuery object
async helper function for finding all stats that meet the given query specified in a StatQuery object
function findStats(query, callback) {
    console.log(query);
    stats.find(query.properties, function(err, results) {
        results = _.sortBy(results, 'value').reverse();
        results = results.slice(query.offset, query.offset + query.size);
        callback(err, results);
    });
}
function findStats ( query , callback ) { console . log ( query ) ; stats . find ( query . properties , function ( err , results ) { results = _ . sortBy ( results , 'value' ) . reverse ( ) ; results = results . slice ( query . offset , query . offset + query . size ) ; callback ( err , results ) ; } ) ; }
async helper function for finding all stats that meet the given query specified in a StatQuery object
async helper function for finding all stats that meet the given query specified in a StatQuery object
// HACK: we're fetching ALL results that meet the search criteria // and throwing away any extra past the specified data page size. // This is OK for this example, but not optimal.