mongodb\Query distinct()

distinct() public method Returns a list of distinct values for the given column across a collection. public array distinct ( $q, $db = null )$q string Column to use. $db yii\mongodb\Connection The Mongo connection used to execute the query. If this parameter is not given, the mongodb application component will be used. return array Array of distinct values

mongodb\Query buildCursor()

buildCursor() public method Builds the Mongo cursor for this query. public \MongoDB\Driver\Cursor buildCursor ( $db = null )$db yii\mongodb\Connection The database connection used to execute the query. return \MongoDB\Driver\Cursor Mongo cursor instance.

mongodb\Query batch()

batch() public method (available since version 2.1) Starts a batch query. A batch query supports fetching data in batches, which can keep the memory usage under a limit. This method will return a yii\mongodb\BatchQueryResult object which implements the Iterator interface and can be traversed to retrieve the data in batches. For example, $query = (new Query)->from('user'); foreach ($query->batch() as $rows) { // $rows is an array of 10 or fewer rows from user collection } public

mongodb\Query average()

average() public method Returns the average of the specified column values. public integer average ( $q, $db = null )$q string The column name. Make sure you properly quote column names in the expression. $db yii\mongodb\Connection The Mongo connection used to execute the query. If this parameter is not given, the mongodb application component will be used. return integer The average of the specified column values.

mongodb\Query all()

all() public method Executes the query and returns all results as an array. public array all ( $db = null )$db yii\mongodb\Connection The Mongo connection used to execute the query. If this parameter is not given, the mongodb application component will be used. return array The query results. If the query results in nothing, an empty array will be returned.

mongodb\Query andFilterCompare()

andFilterCompare() public method (available since version 2.0.5) Helper method for easy querying on values containing some common operators. The comparison operator is intelligently determined based on the first few characters in the given value and internally translated to a MongoDB operator. In particular, it recognizes the following operators if they appear as the leading characters in the given value: <: the column must be less than the given value ($lt). >: the column must be gre

mongodb\Query aggregate()

aggregate() protected method Performs the aggregation for the given column. protected integer aggregate ( $column, $operator, $db )$column string Column name. $operator string Aggregation operator. $db yii\mongodb\Connection The database connection used to execute the query. return integer Aggregation result.

mongodb\Query addOptions()

addOptions() public method Adds additional cursor options. See also options(). public $this addOptions ( $options )$options array Cursor options in format: optionName => optionValue return $this The query object itself

mongodb\Query $options

$options public property Cursor options in format: optionKey => optionValue See also: \MongoDB\Driver\Cursor::addOption() options() public array $options = []

mongodb\Query $select

$select public property The fields of the results to return. For example: ['name', 'group_id'], ['name' => true, '_id' => false]. Unless directly excluded, the "_id" field is always returned. If not set, it means selecting all columns. See also select(). public array $select = []