MongoDB DropIndexes() fails when there is no index
\yii\mongodb\Collection::dropAllIndexes
/**
* Drops all indexes for this collection.
* @throws Exception on failure.
* @return int count of dropped indexes.
*/
public function dropAllIndexes()
{
$result = $this->database->createCommand()->dropIndexes($this->name, '*');
return $result['nIndexesWas'];
}
nIndexesWas index does not return this field when deleting a collection without an index
Should be
public function dropAllIndexes()
{
$result = $this->database->createCommand()->dropIndexes($this->name, '*');
return $result['nIndexesWas']??0;
}
What steps will reproduce the problem?
What's expected?
What do you get instead?
Additional info
MongoDB DropIndexes() fails when there is no index
nIndexesWas index does not return this field when deleting a collection without an index
Should be