lithium\data\source\http\adapter\CouchDb::calculation PHP Method

calculation() public method

Executes calculation-related queries, such as those required for count.
public calculation ( string $type, mixed $query, array $options = [] ) : integer
$type string Only accepts `count`.
$query mixed The query to be executed.
$options array Optional arguments for the `read()` query that will be executed to obtain the calculation result.
return integer Result of the calculation.
    public function calculation($type, $query, array $options = array())
    {
        switch ($type) {
            case 'count':
                return (int) $this->read($query, $options)->stats('total_rows');
            default:
                return null;
        }
    }