Class yii\mongodb\file\Query
Inheritance | yii\mongodb\file\Query » yii\mongodb\Query » yii\base\Component |
---|---|
Implements | yii\db\QueryInterface |
Uses Traits | yii\db\QueryTrait |
Subclasses | yii\mongodb\file\ActiveQuery |
Available since version | 2.0 |
Query represents Mongo "find" operation for GridFS collection.
Query behaves exactly as regular yii\mongodb\Query. Found files will be represented as arrays of file document attributes with additional 'file' key, which stores \MongoGridFSFile instance.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$from | string|array | The collection to be selected from. | yii\mongodb\Query |
$options | array | Cursor options in format: optionKey => optionValue | yii\mongodb\Query |
$select | array | The fields of the results to return. | yii\mongodb\Query |
Public Methods
Method | Description | Defined By |
---|---|---|
addOptions() | Adds additional cursor options. | yii\mongodb\Query |
all() | Executes the query and returns all results as an array. | yii\mongodb\Query |
andFilterCompare() | Helper method for easy querying on values containing some common operators. | yii\mongodb\Query |
average() | Returns the average of the specified column values. | yii\mongodb\Query |
count() | Returns the number of records. | yii\mongodb\Query |
distinct() | Returns a list of distinct values for the given column across a collection. | yii\mongodb\Query |
exists() | Returns a value indicating whether the query result contains any row of data. | yii\mongodb\Query |
from() | Sets the collection to be selected from. | yii\mongodb\Query |
getCollection() | Returns the Mongo collection for this query. | yii\mongodb\file\Query |
max() | Returns the maximum of the specified column values. | yii\mongodb\Query |
min() | Returns the minimum of the specified column values. | yii\mongodb\Query |
modify() | Performs 'findAndModify' query and returns a single row of result. | yii\mongodb\Query |
one() | Executes the query and returns a single row of result. | yii\mongodb\file\Query |
options() | Sets the cursor options. | yii\mongodb\Query |
populate() | Converts the raw query results into the format as specified by this query. | yii\mongodb\file\Query |
select() | Sets the list of fields of the results to return. | yii\mongodb\Query |
sum() | Returns the sum of the specified column values. | yii\mongodb\Query |
Protected Methods
Method | Description | Defined By |
---|---|---|
aggregate() | Performs the aggregation for the given column. | yii\mongodb\Query |
buildCursor() | Builds the Mongo cursor for this query. | yii\mongodb\Query |
fetchRows() | Fetches rows from the given Mongo cursor. | yii\mongodb\Query |
fetchRowsInternal() | yii\mongodb\Query |
Method Details
Returns the Mongo collection for this query.
public yii\mongodb\file\Collection getCollection ( $db = null ) | ||
$db | yii\mongodb\Connection | Mongo connection. |
return | yii\mongodb\file\Collection | Collection instance. |
---|
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 |
return | array|boolean | The first row (in terms of an array) of the query result. False is returned if the query results in nothing. |
---|
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 |
---|