Webiny\Component\Mongo\Mongo::dropIndex PHP Method

dropIndex() public method

public dropIndex ( $collectionName, $indexName, array $options = [] )
$options array
    public function dropIndex($collectionName, $indexName, array $options = [])
    {
        return $this->bridge->dropIndex($this->cName($collectionName), $indexName, $options);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @dataProvider driverSet
  */
 public function testDropIndexes(Mongo $mongo)
 {
     $collection = 'IndexCollection';
     $mongo->dropIndex($collection, 'Name');
     $indexes = $mongo->listIndexes($collection);
     $this->assertNotContains('Name', $indexes);
     $this->assertEquals(4, count($indexes));
     $mongo->dropIndexes($collection);
     // _id_ index is always present so the count is 1 at least
     $this->assertCount(1, $mongo->listIndexes($collection));
 }