PHPDaemon\Clients\Mongo\Collection::ensureIndex PHP Méthode

ensureIndex() public méthode

Ensure index
public ensureIndex ( array $keys, array $options = [], callable $cb = null ) : void
$keys array Keys
$options array Optional. Options
$cb callable Optional. Callback called when response received
Résultat void
    public function ensureIndex($keys, $options = [], $cb = null)
    {
        $this->pool->ensureIndex($this->name, $keys, $options, $cb);
    }

Usage Example

 /**
  *
  */
 public function init()
 {
     $this->externalAuthTokens = $this->appInstance->db->{$this->appInstance->dbname . '.externalAuthTokens'};
     $this->externalAuthTokens->ensureIndex(['extTokenHash' => 1], ['unique' => true]);
 }
All Usage Examples Of PHPDaemon\Clients\Mongo\Collection::ensureIndex