mongodb\QueryBuilder buildAndCondition()

buildAndCondition() public method Connects two or more conditions with the AND operator. public array buildAndCondition ( $operator, $operands )$operator string The operator to use for connecting the given operands $operands array The Mongo conditions to connect. return array The generated Mongo condition.

mongodb\QueryBuilder aggregate()

aggregate() public method Generates 'aggregate' command. public array aggregate ( $collectionName, $pipelines, $options = [] )$collectionName string Collection name $pipelines array List of pipeline operators. $options array Optional parameters. return array Command document.

mongodb\QueryBuilder $db

$db public property The MongoDB connection. public yii\mongodb\Connection $db = null

mongodb\Query sum()

sum() public method Returns the sum of the specified column values. public integer sum ( $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 sum of the specified column values

mongodb\Query select()

select() public method Sets the list of fields of the results to return. public $this select ( array $fields )$fields array Fields of the results to return. return $this The query object itself.

mongodb\Query scalar()

scalar() public method (available since version 2.1.2) Returns the query result as a scalar value. The value returned will be the first column in the first row of the query results. Column _id will be automatically excluded from select fields, if select() is not empty and _id is not selected explicitly. public string|null|false scalar ( $db = null )$db yii\mongodb\Connection The MongoDB connection used to generate the query. If this parameter is not given, the mongodb application compone

mongodb\Query populate()

populate() public method Converts the raw query results into the format as specified by this query. This method is internally used to convert the data fetched from database into the format as required by this query. public array populate ( $rows )$rows array The raw query result from database return array The converted query result

mongodb\Query options()

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

mongodb\Query one()

one() public method Executes the query and returns a single row of result. public array|boolean one ( $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|boolean The first row (in terms of an array) of the query result. False is returned if the query results in nothing.

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.