MongoDB Query Document

This activity is used to retrieve one or more documents from 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 two options: Find One Document or Find Many Documents 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 to match with the documents in a collection.

For example: {"_id":{"$oid":"5d91dd471c9d440000f7aba0"},"location":"Palo Alto","name":"John"}

This activity searches for the documents that match the criteria and returns the output.

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.

Field Description
response A JSON object containing the details of those documents that match the criteria in the activity's input. If you have selected the Find Many Documents operation type, then a JSON array of matching documents is returned.

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.