diff --git a/extensions/mongo/Collection.php b/extensions/mongo/Collection.php index e92480b..64242c1 100644 --- a/extensions/mongo/Collection.php +++ b/extensions/mongo/Collection.php @@ -165,7 +165,7 @@ class Collection extends Object try { $result = $this->mongoCollection->deleteIndexes(); $this->tryResultError($result); - return $result['nIndexesWas'] - 1; + return $result['nIndexesWas']; } catch (\Exception $e) { Yii::endProfile($token, __METHOD__); throw new Exception($e->getMessage(), (int)$e->getCode(), $e); diff --git a/tests/unit/extensions/mongo/CollectionTest.php b/tests/unit/extensions/mongo/CollectionTest.php index 4bce0fa..bc13b2e 100644 --- a/tests/unit/extensions/mongo/CollectionTest.php +++ b/tests/unit/extensions/mongo/CollectionTest.php @@ -270,7 +270,7 @@ class CollectionTest extends MongoTestCase { $collection = $this->getConnection()->getCollection('customer'); $collection->createIndex('name'); - $this->assertEquals(1, $collection->dropAllIndexes()); + $this->assertEquals(2, $collection->dropAllIndexes()); $indexInfo = $collection->mongoCollection->getIndexInfo(); $this->assertEquals(1, count($indexInfo)); }