count(callback) {

    let countQuery = this.__generateCountQuery__(true);

    this.db.query(countQuery.sql, countQuery.params, (err, result) => {

      callback(err, (((result && result.rows) || [])[0] || {}).__total__ || 0);

    });

  }
Counts the results in the query
@param {function} callback Supplied with an error and the integer value of the count