Update Many
AI-generatedSummary
Update many documents in a collection matching a filter
Inputs
- collection (required) — MongoDB collection name to operate on
- filter — JSON filter to select documents for update
- update — Update operations to apply (e.g., {"$set": {"status": "inactive"}})
- options — Additional options for the update, such as upsert, arrayFilters, and conversion settings
Output shape
an array of objects, each containing a json field with the MongoDB update result and a pairedItem linking to the source item
Array length matches the number of input items; missing items indicate failures when continueOnFail is false
Examples
Example 1: Mark all active users as inactive
Collection: "users", Filter: {"status":"active"}, Update: {"$set":{"status":"inactive"}}, Options: {}
Example 2: Upsert customer orders and set processed flag
Collection: "orders", Filter: {"customerId": {"$in": ["c1","c2"]}}, Update: {"$set":{"processed":true}}, Options: {"upsert":true,"arrayFilters":[{"elem":"items.$","status":"shipped"}],"convertIdToObjectId":false}
