yii\mongodb\Collection::createIndexes PHP Méthode

createIndexes() public méthode

Example: php $collection = Yii::$app->mongo->getCollection('customer'); $collection->createIndexes([ [ 'key' => ['name'], ], [ 'key' => [ 'email' => 1, 'address' => -1, ], 'name' => 'my_index' ], ]);
Since: 2.1
public createIndexes ( array $indexes ) : boolean
$indexes array indexes specification, each index should be specified as an array.
Résultat boolean whether operation was successful.
    public function createIndexes($indexes)
    {
        return $this->database->createCommand()->createIndexes($this->name, $indexes);
    }