MongoWriteBatch::executeExecutes a batch of write operations Beschreibung
final public array MongoWriteBatch::execute
( array
$write_options
)Executes the batch of write operations. Parameter-Liste
RückgabewerteReturns 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
Fehler/ExceptionsA MongoWriteConcernException exception is thrown on failure. BeispieleBeispiel #1 MongoWriteBatch::add example Batching up multiple insert operations
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe:
array(2) {
["nInserted"]=>
int(3)
["ok"]=>
bool(true)
}
Beispiel #2 MongoWriteBatch::add example Batching up multiple update operations
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe:
array(4) {
["nMatched"]=>
int(18)
["nModified"]=>
int(2)
["nUpserted"]=>
int(0)
["ok"]=>
bool(true)
}
Beispiel #3 MongoWriteBatch::add example Batching up multiple delete operations
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe:
array(2) {
["nRemoved"]=>
int(1)
["ok"]=>
bool(true)
}
|