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', 'status' => -1, ] |
$options | array |
List of options in format: optionName => optionValue. |
return | boolean |
Whether the operation successful. |
throws | yii\mongodb\Exception |
on failure. |
Please login to continue.