Answer the question
In order to leave comments, you need to log in
Index not created in mongoDB from yii-mongodb during migration?
> create indexes on views ([{"key":{"id":1,"types":1},"name":"id_types_idx"} ]) ...Exception 'yii\mongodb\Exception' with message 'no such cmd: createIndexes
class m161208_132616_mongodb_add_index_to_view_collection extends \yii\mongodb\Migration
{
public function init()
{
$this->db = Yii::$app->mongodb;
parent::init();
}
public function up()
{
$this->createIndexes('views', [
[
'key' => [
'id' => 1,
'types' => 1,
],
'name' => 'id_types_idx'
],
]);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question