yii\mongodb\Command::listIndexes PHP Method

listIndexes() public method

Returns information about current collection indexes.
public listIndexes ( string $collectionName, array $options = [] ) : array
$collectionName string collection name
$options array list of options in format: optionName => optionValue.
return array list of indexes info.
    public function listIndexes($collectionName, $options = [])
    {
        $this->document = $this->db->getQueryBuilder()->listIndexes($collectionName, $options);
        try {
            $cursor = $this->execute();
        } catch (Exception $e) {
            // The server may return an error if the collection does not exist.
            $notFoundCodes = [26, 60];
            if (in_array($e->getCode(), $notFoundCodes, true)) {
                return [];
            }
            throw $e;
        }
        return $cursor->toArray();
    }