Navigation

update

On this page

Definition

update

Modifies one or more documents in a MongoDB collection.

Important

In order to use MongoDB service actions, you must have rules set up for each namespace included in the operation.

You can only use the update action in the first stage of a pipeline.

The update action stage has the following syntax:

{
   "service": "mongodb-atlas",
   "action": "update",
   "args": {
      "database": <dbname>,
      "collection": <collection name>,
      "query": <filter document>,
      "update": <update document>,
      "upsert": <boolean>,
      "multi": <boolean>
   }
}

The update action takes the following arguments:

Argument Type Description
database string Name of the database.
collection string Name of the collection.
query document Query filter to apply for the update operation. Specify the filter as a JSON document. Filter expression can include MongoDB query expressions as well as variables (%%vars) defined in the stage.
update document Specifications for the modifications to make. To update a document, MongoDB provides update operators, such as $set, to modify field values.
upsert boolean Optional. If set to true, creates a new document when no document matches the query criteria. The default value is false, which does not insert a new document when no match is found.
multi boolean Optional. If set to true, updates multiple documents that meet the query criteria. If set to false, limits the update to a single document. The default value is false.