Skip to content

Commit

Permalink
Fix #286: Fix Collection::dropAllIndexes() error when no indexes we…
Browse files Browse the repository at this point in the history
…re dropped
  • Loading branch information
samdark authored Nov 19, 2019
1 parent 99e0208 commit da61c7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Yii Framework 2 mongodb extension Change Log
2.1.9 under development
-----------------------

- no changes in this release.
- Bug #286: Fix `Collection::dropAllIndexes()` error when no indexes were dropped (samdark)


2.1.8 October 08, 2019
Expand Down
2 changes: 1 addition & 1 deletion src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function dropIndex($columns)
public function dropAllIndexes()
{
$result = $this->database->createCommand()->dropIndexes($this->name, '*');
return $result['nIndexesWas'];
return isset($result['nIndexesWas']) ? $result['nIndexesWas'] : 0;
}

/**
Expand Down

0 comments on commit da61c7b

Please sign in to comment.