mongodb\Query modify()

modify() public method Performs 'findAndModify' query and returns a single row of result. public array|null modify ( $update, $options = [], $db = null )$update array Update criteria $options array List of options in format: optionName => optionValue. $db yii\mongodb\Connection The Mongo connection used to execute the query. return array|null The original document, or the modified document when $options['new'] is set.

mongodb\Query min()

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

mongodb\Query getCollection()

getCollection() public method Returns the Mongo collection for this query. public yii\mongodb\Collection getCollection ( $db = null )$db yii\mongodb\Connection Mongo connection. return yii\mongodb\Collection Collection instance.

mongodb\Query fetchRowsInternal()

fetchRowsInternal() protected method See also yii\mongodb\Query::fetchRows(). protected array|boolean fetchRowsInternal ( $cursor, $all )$cursor \MongoDB\Driver\Cursor Mongo cursor instance to fetch data from. $all boolean Whether to fetch all rows or only first one. return array|boolean Result.

mongodb\Query from()

from() public method Sets the collection to be selected from. public $this from ( $collection )$collection return $this The query object itself.

mongodb\Query each()

each() public method (available since version 2.1) Starts a batch query and retrieves data row by row. This method is similar to batch() except that in each iteration of the result, only one row of data is returned. For example, $query = (new Query)->from('user'); foreach ($query->each() as $row) { } public yii\mongodb\BatchQueryResult each ( $batchSize = 100, $db = null )$batchSize integer The number of records to be fetched in each batch. $db yii\mongodb\Connection The MongoDB

mongodb\Query fetchRows()

fetchRows() protected method Fetches rows from the given Mongo cursor. protected array|boolean fetchRows ( $cursor, $all = true, $indexBy = null )$cursor \MongoDB\Driver\Cursor Mongo cursor instance to fetch data from. $all boolean Whether to fetch all rows or only first one. $indexBy string|callable The column name or PHP callback, by which the query results should be indexed by. return array|boolean Result. throws yii\mongodb\Exception on failure.

mongodb\Query exists()

exists() public method Returns a value indicating whether the query result contains any row of data. public boolean exists ( $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 boolean Whether the query result contains any row of data.

mongodb\Query count()

count() public method Returns the number of records. public integer count ( $q = '*', $db = null )$q string Kept to match yii\db\QueryInterface, its value is ignored. $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 Number of records throws yii\mongodb\Exception on failure.

mongodb\Query column()

column() public method (available since version 2.1.2) Executes the query and returns the first column of the result. Column _id will be automatically excluded from select fields, if select() is not empty and _id is not selected explicitly. public array column ( $db = null )$db yii\mongodb\Connection The MongoDB connection used to generate the query. If this parameter is not given, the mongodb application component will be used. return array The first column of the query result. An emp