Commit 11f8a2d1 by Klimov Paul

Using of `MongoCollection::createIndex()` provided

parent 1c9fc33a
...@@ -222,7 +222,11 @@ class Collection extends Object ...@@ -222,7 +222,11 @@ class Collection extends Object
Yii::info($token, __METHOD__); Yii::info($token, __METHOD__);
try { try {
Yii::beginProfile($token, __METHOD__); Yii::beginProfile($token, __METHOD__);
if (method_exists($this->mongoCollection, 'createIndex')) {
$result = $this->mongoCollection->createIndex($keys, $options);
} else {
$result = $this->mongoCollection->ensureIndex($keys, $options); $result = $this->mongoCollection->ensureIndex($keys, $options);
}
$this->tryResultError($result); $this->tryResultError($result);
Yii::endProfile($token, __METHOD__); 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