mongodb\Collection group()

group() public method Performs aggregation using Mongo "group" command. public array group ( $keys, $initial, $reduce, $options = [] )$keys mixed Fields to group by. If an array or non-code object is passed, it will be the key used to group results. If instance of \MongoDB\BSON\Javascript passed, it will be treated as a function that returns the key to group by. $initial array Initial value of the aggregation counter object. $reduce \MongoDB\BSON\Javascript|string Function that take

mongodb\Collection findAndModify()

findAndModify() public method Updates a document and returns it. public array|null findAndModify ( $condition, $update, $options = [] )$condition array Query condition $update array Update criteria $options array List of options in format: optionName => optionValue. return array|null The original document, or the modified document when $options['new'] is set. throws yii\mongodb\Exception on failure.

mongodb\Collection find()

find() public method Returns a cursor for the search results. In order to perform "find" queries use yii\mongodb\Query class. See also yii\mongodb\Query. public \MongoDB\Driver\Cursor find ( $condition = [], $fields = [], $options = [] )$condition array Query condition $fields array Fields to be selected $options array Query options (available since 2.1). return \MongoDB\Driver\Cursor Cursor for the search results

mongodb\Collection findOne()

findOne() public method Returns a single document. public array|null findOne ( $condition = [], $fields = [], $options = [] )$condition array Query condition $fields array Fields to be selected $options array Query options (available since 2.1). return array|null The single document. Null is returned if the query results in nothing.

mongodb\Collection dropIndexes()

dropIndexes() public method Drops collection indexes by name. public integer dropIndexes ( $indexes )$indexes string Wildcard for name of the indexes to be dropped. You can use * to drop all indexes. return integer Count of dropped indexes.

mongodb\Collection dropAllIndexes()

dropAllIndexes() public method Drops all indexes for this collection. public integer dropAllIndexes ( )return integer Count of dropped indexes. throws yii\mongodb\Exception on failure.

mongodb\Collection dropIndex()

dropIndex() public method Drop indexes for specified column(s). public boolean dropIndex ( $columns )$columns string|array Column name or list of column names. If array is given, each element in the array has as key the field name, and as value either 1 for ascending sort, or -1 for descending sort. Use value 'text' to specify text index. You can specify field using native numeric key with the field name as a value, in this case ascending sort will be used. For example: [ 'name',

mongodb\Collection drop()

drop() public method Drops this collection. public boolean drop ( )return boolean Whether the operation successful. throws yii\mongodb\Exception on failure.

mongodb\Collection createIndexes()

createIndexes() public method (available since version 2.1) Creates several indexes at once. Example: $collection = Yii::$app->mongo->getCollection('customer'); $collection->createIndexes([ [ 'key' => ['name'], ], [ 'key' => [ 'email' => 1, 'address' => -1, ], 'name' => 'my_index' ], ]); public boolean createIndexes ( $indexes )$indexes array[] Indexes specification. Each specification shoul

mongodb\Collection createIndex()

createIndex() public method Creates an index on the collection and the specified fields. public boolean createIndex ( $columns, $options = [] )$columns array|string Column name or list of column names. If array is given, each element in the array has as key the field name, and as value either 1 for ascending sort, or -1 for descending sort. You can specify field using native numeric key with the field name as a value, in this case ascending sort will be used. For example: [ 'name',