> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# Modify Multiple Documents

MongoDB Compass Readonly Edition will be deprecated in a future release. To replicate the read-only behavior in a standard Compass edition, assign users [`read`](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-authrole-read) access at the database level and enable the [readOnly](https://www.mongodb.com/docs/compass/settings/read-only.md#std-label-compass-read-only) option in Compass.

You can perform bulk update operations on multiple documents in Compass by using the Update Documents modal. Performing updates with the Update Documents modal helps you visualize updates to your data before you apply them.

## About this Task

- You can use any syntax that works with the `update` parameter of [`db.collection.updateMany()`.](https://www.mongodb.com/docs/manual/reference/method/db.collection.updateMany.md#mongodb-method-db.collection.updateMany)

- The Update Documents modal does not support any `options` parameters such as upsert, writeConcern, or collation.

- Previews of the documents affected by bulk update operations are only visible if your database is configured to support transactions. For details, see [/core/transactions.](https://www.mongodb.com/docs/manual/core/transactions/)

## Steps

1. Apply a query filter.

   From the Documents tab, input a query into the Query bar. The filter criteria of the query specified applies to the documents in the Bulk Update modal. If you need to apply an update to all documents in a collection, leave the Query bar blank.

2. Open the bulk update modal.

   On the Documents tab, click the  Bulk drop-down menu and select Bulk update documents. Alternatively, you can right-click the surrounding white space and select Bulk update to display the Update Documents modal.

   The modal contains the following information:

   | UI Element | Description |
   | --- | --- |
   | Filter | Any filter criteria specified on the Query Bar applies to the Update Documents modal. To update the filter query, exit the Update Documents modal and modify the query in the Query Bar. |
   | Update | The update syntax that is applied to the documents specified in the filter criteria. You can use any syntax that works with the `update` parameter of the [`db.collection.updateMany()`.](https://www.mongodb.com/docs/manual/reference/method/db.collection.updateMany.md#mongodb-method-db.collection.updateMany) |
   | Preview | A preview of documents with the update syntax applied. |

3. Enter the update syntax.

   In the Update text field, provide the update syntax.

   The number of documents affected by the update displays at the top of the Update Documents modal.

   **Note:**

   The documents under the Preview header show how the Update syntax affects documents in your collection.

4. (Optional) Name and save your Update.

   You can name and save the update query in the Update Documents modal. Saving your query adds it to your [favorite queries](https://www.mongodb.com/docs/compass/query/queries.md#std-label-compass-saved-favorite-query-view) for that collection and allows you to load and copy the query after you close the modal.

   Click the Save button on the bottom left of the modal.

   Enter a name for the update syntax.

   Click the green Save button.

5. Update your documents.

   Click Update Documents.

   Compass applies the Update to the documents within the Filter expression.

## Example

The following example uses the [sample\_mflix dataset.](https://www.mongodb.com/docs/atlas/import/load-sample-data.md#std-label-sample-data)

This example updates the `tomatoes.viewer.numReviews` and `tomatoes.viewer.meter` fields with the Compass Update Documents modal.

Apply a filter in the Query Bar to filter movies which have a `year` of `1917`.

```javascript
{ 'year' : 1917 }
```

Click the  Bulk drop-down menu and select Bulk update documents. The Update Documents modal displays.

In the Update text box, paste the following syntax:

```javascript
{
   $inc: { "tomatoes.viewer.numReviews" : 1},
   $set: { "tomatoes.viewer.meter" : 99 }
}
```

This syntax:

- [Increments](https://www.mongodb.com/docs/manual/reference/operator/update/inc/) the `tomatoes.viewer.numReviews` field by `1`.

- [Sets](https://www.mongodb.com/docs/manual/reference/operator/update/set/) the `tomatoes.viewer.meter` field to `99`.

The Preview section populates with sample documents affected by the update query.

To view the updates to the numReviews and meter fields:

- Click the  arrow icon next to tomatoes.

- Click the  arrow icon next to viewer.

Click the Update Documents button to update the collection's data.

## Learn More

- [Delete Multiple Documents](https://www.mongodb.com/docs/compass/documents/delete-multiple.md#std-label-compass-bulk-delete)

- [Use the Favorites Tab](https://www.mongodb.com/docs/compass/query/queries.md#std-label-compass-saved-favorite-query-view)
