See also: MongoDB\Database::createCollection()
See also: http://docs.mongodb.org/manual/reference/command/create/
Inheritance: implements Phalcon\Db\Adapter\MongoDB\Operation\Executable
Example #1
0
 /**
  * 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);
 }