MongoDB Update Document

This activity is used to update one or more documents and replace a particular document in a collection of the MongoDB database using a JSON like query.

Settings

Field Description
Connection Select an existing MongoDB connection from the Connection list.
Operation Select from the three options: Update One Document, Update Many Documents or Replace One Document from the Operation list.
Database Name Name of the database that you want to connect in the MongoDB instance
Collection Name Name of the collection in the database.
Timeout Timeout in seconds for the activity's operations.

Input

The Input tab displays the input schema of the activity as a tree structure. You can provide the input values in the Flogo Connector for MongoDB mapping input fields directly or use Mapper to map the input values to a field from the output of a preceding activity in the flow.

The Input tab has the following fields:

Field Type Description
criteria JSON object A valid JSON that contains one or more fields that matches the documents in a collection for update operation.
Note: To update all the documents in a collection, pass an empty JSON object such as {} as the value for criteria and select Update Many Documents as the Operation type in the settings tab.
updateData JSON object A JSON that contains the data that is used to update the documents identified by the criteria input field.

Output

The Output tab displays the schema for the output data of this activity in a tree format. You can map the elements in the schema as input for the subsequent activities in the flow.

The Output tab has the following fields:

Field Description
matchedCount Returns the total number of documents that matched the criteria for update.
updatedCount Returns the total number of documents that were updated.

Loop

If you would like this activity to iterate multiple times within the flow, enter an expression that evaluates to the iteration details. Select a type of iteration from the Type menu. The default type is None, which means the activity will not iterate. Refer to the "Using the Loop Feature in an Activity" topic in the TIBCO Flogo® Enterprise.