public function ensureUniqueIndex(array $key, $dropDups = false)
    {
        $this->getMongoCollection()->createIndex($key, array(
            'unique'    => true,
            'dropDups'  => (bool) $dropDups,
        ));

        return $this;
    }
public function ensureUniqueIndex(array $key, $dropDups = false)
    {
        $this->getMongoCollection()->createIndex($key, array(
            'unique'    => true,
            'dropDups'  => (bool) $dropDups,
        ));

        return $this;
    }
public function ensureUniqueIndex ( array $ key , $ dropDups = false ) { $ this -> getMongoCollection ( ) -> createIndex ( $ key , array ( 'unique' => true , 'dropDups' => ( bool ) $ dropDups , ) ) ; return $ this ; }
Create unique index

@param array $key
@param boolean $dropDups
@return \Sokil\Mongo\Collection
Create unique index