MongoDB\Driver\BulkWrite
PHP Manual

MongoDB\Driver\BulkWrite::update

(mongodb >=0.2.0)

MongoDB\Driver\BulkWrite::updateAdd an update operation to the bulk

Açıklama

public void MongoDB\Driver\BulkWrite::update ( array|object $filter , array|object $newObj [, array $updateOptions ] )

Değiştirgeler

filter

The search filter.

newObj

Either an array of update operators, or the full object to be replaced with

updateOptions

updateOptions
Option Type Description Default
multi boolean Update only the first matching document (multi=false), or all matching documents (multi=true) false
upsert boolean If filter does not match an existing document, insert the newObj as a new object, applying any atomic modifiers to the filter if applicable. 0

Dönen Değerler

Hiçbir değer dönmez.

Hatalar/İstisnalar

Örnekler

Örnek 1 MongoDB\Driver\BulkWrite::update() example

<?php

$bulk 
= new MongoDB\Driver\BulkWrite(true);
$bulk->update(array("tag" => "mongodb"), array("multi" => false));
$bulk->update(array(  "x" => "2"     ), array("y" => 3'$set' => array("z" => 4)), array("upsert" => 0));

$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
$writeConcern = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY1000);
$result $manager->executeBulkWrite("databaseName.collectionName"$bulk$writeConcern);

?>

Ayrıca Bakınız


MongoDB\Driver\BulkWrite
PHP Manual