Skip to main content
Roberty Studio
RPAMongoDB

MongoDB - Update multiple documents

MongoDB - Update multiple documents

Updates every 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 documents to update, for example { "status": "pendente" }.

Document or pipeline to update​

Update document or pipeline in MongoDB format, for example { "$set": { "status": "processado" } }.

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"].modifiedCount // number of modified documents (Any)

Field selection​

  • modifiedCount — number of documents that were modified (Any)

Rules and Conditions​

  • The Select a collection, Filter and Document or pipeline to update fields are required.
  • Every document matching the filter is updated.
  • If no document matches the filter, nothing is changed.