yii\mongodb\file\Collection::ensureIndexes PHP Method

ensureIndexes() public method

The check result is cached per collection instance.
public ensureIndexes ( boolean $force = false )
$force boolean whether to ignore internal collection instance cache.
    public function ensureIndexes($force = false)
    {
        if (!$force && $this->indexesEnsured) {
            return $this;
        }
        $this->ensureFileIndexes();
        $this->ensureChunkIndexes();
        $this->indexesEnsured = true;
        return $this;
    }