/** * Create a new collection explicitly. * * @see CreateCollection::__construct() for supported options * * @param string $collectionName * @param array $options * * @return array|object Command result document */ public function createCollection($collectionName, array $options = []) { if (!isset($options['typeMap'])) { $options['typeMap'] = $this->typeMap; } $operation = new CreateCollection($this->databaseName, $collectionName, $options); $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY)); return $operation->execute($server); }