MongoDB Update
This Snap updates documents in a MongoDB collection and supports the upsert capability.
Overview
You can use this Snap to update documents in a MongoDB collection. It also supports the upsert capability.

Supported Accounts
- This is a Write-type Snap.
Prerequisites
None.
Limitations and known issues
None.
Snap views
| Type | Description | Examples of upstream and downstream Snaps |
|---|---|---|
| Input | This Snap has exactly one document input view. Mapped data to evaluate expression properties and/or to update documents in a MongoDB collection. Each input document produces one document at the output view or the error view. | |
| Output |
Optional. This Snap has at most one document output view.
For example, if the existing documents are:
And an update with query{} and input document of:
then the result will be as follows:
Note:
|
|
| Learn more about Error handling. | ||
Snap settings
| Field/Field set | Description |
|---|---|
Label String |
Required.Specify a unique name for the Snap. Modify this to
be more appropriate, especially if there are more than one of the same Snap in the
pipeline.
Default value: MongoDB - Update |
Database name String/Expression/ Suggestion |
The database in which the collection is defined. If not specified, then the MongoDB account database will be used. Default value: N/A Example: assets |
Collection name String/Expression/ Suggestion |
Required. Select or enter a MongoDB collection name. Default value: N/A Example: leads |
Update query String/Expression |
Required. The update query represents the update query parameter. It is an expression that evaluates to an object or JSON string. When the expression evaluates to an object, only strict mode is supported. When the expression evaluates to a JSON string, both strict mode and mongo shell mode are supported. More information about MongoDB Extended JSON can be found here. Example: (with '=' expression enabled) $id represents an integer in this example.
or
Default value: N/A |
Update operation String/Expression/ Suggestion |
The operation to be performed on the update query. Default value: $set Example: $min |
Exclude list
Fieldset |
List of input fields to exclude from the dataset. |
Exclude field String/Suggestion |
The list of input fields that must be removed from the dataset before sending the dataset to MongoDB. Default value: _id Example: $ranking |
Array filters String/Expression |
The filter conditions to determine the array elements you want to modify for the update operation. This field supports upstream values. Default value: N/A Example: $arrayFilters |
Upsert Checkbox |
If selected, a document from the input view is inserted if no document in the collection matches the update query criteria. Default status: Deselected |
Update all that match Checkbox |
If selected, all documents in the collection that match the update query criteria are updated; otherwise the Snap updates only one document. Default status: Selected |
Pass through Checkbox |
If selected, the input document will be passed through to the output view under the key 'original'. The document will be passed to the Parameter output view, and it will also be passed to the Result Set output view if there is output sent from this view. Default status: Selected |
Number of retries Integer/Expression |
Specify the maximum number of attempts to be made to receive a response. The request is terminated if the attempts do not result in a response. Note:
Default value: 0 Example: 4 |
Retry interval (seconds) Integer/Expression |
Specify the time interval between two retry requests. Default value: 1 Example: 5 |
|
Snap execution Dropdown list
|
Choose one of the three modes in
which the Snap executes. Available options are:
Default value: Execute only Example: Validate & Execute |