lithium\data\source\MongoDb::calculation()

public method

Executes calculation-related queries, such as those required for count.

Parameters

  • string $type

    Only accepts count.

  • mixed $query

    The query to be executed.

  • array $options

    Optional arguments for the read() query that will be executed to obtain the calculation result.

Returns

integer

Result of the calculation.

Source

	public function calculation($type, $query, array $options = array()) {
		$query->calculate($type);

		switch ($type) {
			case 'count':
				return $this->read($query, $options)->count();
		}
	}