Commit 1a9d5a11 by Paul Klimov

Mongo Collection "deleteAllIndexes" return result fixed.

parent e3c281f3
...@@ -165,7 +165,7 @@ class Collection extends Object ...@@ -165,7 +165,7 @@ class Collection extends Object
try { try {
$result = $this->mongoCollection->deleteIndexes(); $result = $this->mongoCollection->deleteIndexes();
$this->tryResultError($result); $this->tryResultError($result);
return $result['nIndexesWas'] - 1; return $result['nIndexesWas'];
} catch (\Exception $e) { } catch (\Exception $e) {
Yii::endProfile($token, __METHOD__); Yii::endProfile($token, __METHOD__);
throw new Exception($e->getMessage(), (int)$e->getCode(), $e); throw new Exception($e->getMessage(), (int)$e->getCode(), $e);
......
...@@ -270,7 +270,7 @@ class CollectionTest extends MongoTestCase ...@@ -270,7 +270,7 @@ class CollectionTest extends MongoTestCase
{ {
$collection = $this->getConnection()->getCollection('customer'); $collection = $this->getConnection()->getCollection('customer');
$collection->createIndex('name'); $collection->createIndex('name');
$this->assertEquals(1, $collection->dropAllIndexes()); $this->assertEquals(2, $collection->dropAllIndexes());
$indexInfo = $collection->mongoCollection->getIndexInfo(); $indexInfo = $collection->mongoCollection->getIndexInfo();
$this->assertEquals(1, count($indexInfo)); $this->assertEquals(1, count($indexInfo));
} }
......
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