A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/drivers/php/laravel-mongodb/current/usage-examples/updateMany/ below:

Update Multiple Documents - Laravel MongoDB

You can update multiple documents in a collection by calling the update() method on a query builder.

Pass a query filter to the where() method to retrieve documents that meet a set of criteria. Then, update the matching documents by passing your intended document changes to the update() method.

Tip

To learn more about updating data with the Laravel Integration, see the Modify Documents section of the Write Operations guide.

Select from the following Eloquent and Query Builder tabs to view usage examples for the same operation that use each corresponding query syntax:

This example performs the following actions:

The example calls the following methods on the Movie model:

$updates = Movie::where('imdb.rating', '>', 9.0)    ->update(['acclaimed' => true]);echo 'Updated documents: ' . $updates;

This example performs the following actions:

The example calls the following query builder methods:

$updates = DB::table('movies')    ->where('imdb.rating', '>', 9.0)    ->update(['acclaimed' => true]);echo 'Updated documents: ' . $updates;

To learn how to edit your Laravel application to run the usage example, see the Usage Examples landing page.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4