lithium\data\source\MongoDb::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())
    {
        $query->calculate($type);
        switch ($type) {
            case 'count':
                return $this->read($query, $options)->count();
        }
    }