Update a document

suggest change

Example for updating all documents where name is equal to “John”:

$filter = ['name' => 'John'];
$document = ['name' => 'Mike'];

$bulk = new \MongoDB\Driver\BulkWrite;
$bulk->update(
    $filter,
    $document,
    ['multi' => true]
);
$result = $manager->executeBulkWrite('database_name.collection_name', $bulk);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents