See also: MongoDB\Collection::insertMany()
See also: http://docs.mongodb.org/manual/reference/command/insert/
Inheritance: implements Phalcon\Db\Adapter\MongoDB\Operation\Executable
Beispiel #1
0
 /**
  * Inserts multiple documents.
  *
  * @see InsertMany::__construct() for supported options
  * @see http://docs.mongodb.org/manual/reference/command/insert/
  *
  * @param array[]|object[] $documents The documents to insert
  * @param array            $options Command options
  *
  * @return InsertManyResult
  */
 public function insertMany(array $documents, array $options = [])
 {
     if (!isset($options['writeConcern'])) {
         $options['writeConcern'] = $this->writeConcern;
     }
     $operation = new InsertMany($this->databaseName, $this->collectionName, $documents, $options);
     $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
     return $operation->execute($server);
 }