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, // namespace not found
                60 // database not found
            ];
            if (in_array($e->getCode(), $notFoundCodes, true)) {
                return [];
            }

            throw $e;
        }

        return $cursor->toArray();
    }
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, // namespace not found
                60 // database not found
            ];
            if (in_array($e->getCode(), $notFoundCodes, true)) {
                return [];
            }

            throw $e;
        }

        return $cursor->toArray();
    }
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 , // namespace not found 60 // database not found ] ; if ( in_array ( $ e -> getCode ( ) , $ notFoundCodes , true ) ) { return [ ] ; } throw $ e ; } return $ cursor -> toArray ( ) ; }
Returns information about current collection indexes.
@param string $collectionName collection name
@param array $options list of options in format: optionName => optionValue.
@return array list of indexes info.
@throws Exception on failure.
Returns information about current collection indexes .