MongoWriteBatch::executeExecutes a batch of write operations Description
final public array MongoWriteBatch::execute
( array
$write_options
)Executes the batch of write operations. Parameters
Return ValuesReturns an array containing statistical information for the full batch. If the batch had to be split into multiple batches, the return value will aggregate the values from individual batches and return only the totals.
If the batch was empty, an array containing only the 'ok' field is returned (as
Errors/ExceptionsA MongoWriteConcernException exception is thrown on failure. ExamplesExample #1 MongoWriteBatch::add example Batching up multiple insert operations
<?php The above example will output: array(2) { ["nInserted"]=> int(3) ["ok"]=> bool(true) } Example #2 MongoWriteBatch::add example Batching up multiple update operations
<?php The above example will output: array(4) { ["nMatched"]=> int(18) ["nModified"]=> int(2) ["nUpserted"]=> int(0) ["ok"]=> bool(true) } Example #3 MongoWriteBatch::add example Batching up multiple delete operations
<?php The above example will output: array(2) { ["nRemoved"]=> int(1) ["ok"]=> bool(true) } |