Commit 11f8a2d1 by Klimov Paul

Using of `MongoCollection::createIndex()` provided

parent 1c9fc33a
......@@ -222,7 +222,11 @@ class Collection extends Object
Yii::info($token, __METHOD__);
try {
Yii::beginProfile($token, __METHOD__);
$result = $this->mongoCollection->ensureIndex($keys, $options);
if (method_exists($this->mongoCollection, 'createIndex')) {
$result = $this->mongoCollection->createIndex($keys, $options);
} else {
$result = $this->mongoCollection->ensureIndex($keys, $options);
}
$this->tryResultError($result);
Yii::endProfile($token, __METHOD__);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment