MongoDB Ex icon

MongoDB Ex

MongoDB Extended - Advanced MongoDB operations, including support for filters, bulk operations, full update JSON support and more.

Document → Update

AI-generated

Summary

Update documents in a MongoDB collection matching a filter and apply an update definition

Inputs

  • collection (required) — MongoDB Collection
  • updateFilter (required) — MongoDB filter object that determines which documents should be updated. You can construct complex filters using MongoDB query operators. Example: {"_id": "507f1f77bcf86cd799439011"} or {"status": "active", "age": {"$gte": 18}}
  • update — Provide a MongoDB update definition. You can configure a full update object (e.g. {$set, $unset, $inc, ...}) or an update pipeline (array of stages) as supported by MongoDB.
  • upsert — Whether to perform an insert if no documents match the update key
  • options — Additional operation-specific options such as timeout, maxTime, hint, arrayFilters, many, etc.

Output shape

an array of update result objects

Each element reflects MongoDB's write result (e.g., matchedCount, modifiedCount, upsertedId) and the array length equals the number of processed items.

Examples

Example 1: Update a single user document

Collection: "users"; Update Filter: {"_id": "{{$json.id}}"}; Update: {"$set": {"status": "active"}}; Upsert: false; Options: {}

Example 2: Increment a counter on multiple pending orders

Collection: "orders"; Update Filter: {"status": "pending"}; Update: {"$inc": {"counter": 1}}; Upsert: false; Options: {"many": true}

Discussion