Phalcon\Db\Adapter\MongoDB\Collection::dropIndex PHP Method

dropIndex() public method

Drop a single index in the collection.
See also: DropIndexes::__construct() for supported options
public dropIndex ( string $indexName, array $options = [] ) : array | object
$indexName string Index name
$options array Additional options
return array | object Command result document
    public function dropIndex($indexName, array $options = [])
    {
        $indexName = (string) $indexName;
        if ($indexName === '*') {
            throw new InvalidArgumentException('dropIndexes() must be used to drop multiple indexes');
        }
        if (!isset($options['typeMap'])) {
            $options['typeMap'] = $this->typeMap;
        }
        $operation = new DropIndexes($this->databaseName, $this->collectionName, $indexName, $options);
        $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
        return $operation->execute($server);
    }