RPAMongoDB
MongoDB - Update one document
MongoDB - Update one document
Updates the first document in a MongoDB collection that matches the given filter, applying the changes defined in the update document or pipeline.
Options
Select a collection
Reference to the MongoDB: Select collection action the update will run on.
Filter (query)
Filter identifying the document to update, for example { "_id": "64abc123" }.
Document or pipeline to update
Update document or pipeline in MongoDB format, for example { "$set": { "status": "inativo" } }.
Select a transaction
Reference to a MongoDB: Start transaction action when the operation must run inside a transaction. Optional field, available under the advanced options.
Returns
Javascript code
js
actions["action-id"].modified // true if the document was modified, false otherwise (Any)
Field selection
- modified — true if the document was modified, false otherwise (Any)
Rules and Conditions
- The Select a collection, Filter and Document or pipeline to update fields are required.
- Only the first document matching the filter is updated.
- If no document matches the filter, nothing is changed.