yii\mongodb\Command::createCollection PHP Method

createCollection() public method

Creates new collection in database associated with this command.s
public createCollection ( string $collectionName, array $options = [] ) : boolean
$collectionName string collection name
$options array collection options in format: "name" => "value"
return boolean whether operation was successful.
    public function createCollection($collectionName, array $options = [])
    {
        $this->document = $this->db->getQueryBuilder()->createCollection($collectionName, $options);
        $result = current($this->execute()->toArray());
        return $result['ok'] > 0;
    }