MongoDB\ClientBulkWrite::withCollection()
Novidades na versão 2.1.
Definição
MongoDB\ClientBulkWrite::withCollection()
Return an updated instance of
MongoDB\ClientBulkWrite
from the providedMongoDB\Collection
instance. This method allows you to add subsequent write operations on a different collection than that with which theClientBulkWrite
was created.This method does not build a new BulkWriteCommand and does not edit the
ClientBulkWrite
instance in place.function withCollection( Collection $collection, ): self You cannot mix
Collection
instances associated with differentManager
objects when calling this method on aClientBulkWrite
instance. This is because the library sends the completedBulkWriteCommand
to a single server.
Parâmetros
$collection
:MongoDB\Collection
- The
Collection
instance to set as the target for write operations added to theClientBulkWrite
instance after callingwithCollection()
.
Return Values
A new ClientBulkWrite
instance with the same BulkWriteCommand
specification but an updated target namespace.
Erros/exceções
MongoDB\Exception\UnsupportedException
se as opções forem usadas e não aceitas pelo servidor selecionado (p. ex., collation
, readConcern
, writeConcern
).
MongoDB\Exception\InvalidArgumentException
para erros relacionados à análise de parâmetros ou opções.
MongoDB\Driver\Exception\RuntimeException para outros erros no nível da extensão (por exemplo erros de conexão).