public function insertMany(array $documents, array $options = [])
    {
        if ( ! isset($options['writeConcern']) && ! $this->isInTransaction($options)) {
            $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);
    }
public function insertMany(array $documents, array $options = [])
    {
        if ( ! isset($options['writeConcern']) && ! $this->isInTransaction($options)) {
            $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);
    }
public function insertMany ( array $ documents , array $ options = [ ] ) { if ( ! isset ( $ options [ 'writeConcern' ] ) && ! $ this -> isInTransaction ( $ options ) ) { $ 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 ) ; }
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
@throws InvalidArgumentException for parameter/option parsing errors
@throws DriverRuntimeException for other driver errors (e.g. connection errors)
Inserts multiple documents .