classes/table.js
/**
     * Return the number of records matching the request. Count all records by default
     * @param _filters
     * @param callback
     */
Return the number of records matching the request. Count all records by default
@param _filters
@param callback
Return the number of records matching the request . Count all records by default @param _filters @param callback
count(_filters, callback) {
        if (_.isFunction(_filters)) {
            callback = _filters;
            _filters = {};
        }
        if (!_.isFunction(callback)) throw new Error('Callback must be a function');
        if (_.isNil(_filters)) return callback({error: `Filters can't be explicitly ${typeof _filters} in ${this.name}.del`});
        let filters = _.cloneDeep(_filters);
        return this.db.query(this.composeQuery(this.queries.count, filters))
          .then(count => count[0]['cnt']);
    }
count ( _filters , callback ) { if ( _ . isFunction ( _filters ) ) { callback = _filters ; _filters = { } ; } if ( ! _ . isFunction ( callback ) ) throw new Error ( 'Callback must be a function' ) ; if ( _ . isNil ( _filters ) ) return callback ( { error : ` ${ typeof _filters } ${ this . name } ` } ) ; let filters = _ . cloneDeep ( _filters ) ; return this . db . query ( this . composeQuery ( this . queries . count , filters ) ) . then ( count => count [ 0 ] [ 'cnt' ] ) ; }
Return the number of records matching the request.
Return the number of records matching the request .