run_transaction
Execute multiple MongoDB writes atomically so all operations commit or none apply; requires a replica set or sharded cluster. On failure, the error identifies the failing step.
Instructions
Execute several writes atomically (all or nothing). Requires a replica set or sharded cluster.
operations: [{"op": "insert", "collection": "orders", "document": {...}}, {"op": "update", "collection": "stock", "filter": {...}, "update": {"$inc": {"qty": -1}}}, {"op": "insert_many" | "update_many" | "replace" | "delete" | "delete_many", ...}] If any operation fails, nothing is written and the error names the failing step.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | ||
| connection | No | ||
| operations | Yes |