MongoDB Insert Document

This activity is used to insert one or more documents into a collection in a MongoDB database.

Settings

On the Settings tab, you can define the MongoDB connection, operation, database name, and collection name that must be used.

Field Description
Connection Select an existing MongoDB connection from the connection list.
Operation Select from the two options: Insert One document or Insert 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.
Continue on Error This field is displayed only if the Insert Many Documents option is selected as the operation. Select this field if you want to continue the insert operation even after an error occurs.

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 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
data JSON object A valid JSON that contains the document data to be inserted into the collection.

For example: {"location":"Palo Alto","name":"John"}

To insert more than one document in the collection, pass a valid JSON Array.

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 Type Description
insertedId String An unique ID of the inserted document. If you have selected Insert Many operation, then a list of inserted IDs is returned.
totalCount number The total number of documents specified in the activity's input for the insert operation. Shown only if you have selected Insert Many operation.
successCount number The total number of documents successfully inserted in the collection. Shown only if you have selected Insert Many operation.
failureCount number The number of documents that were not inserted in the collection. Shown only if you have selected Insert Many operation.

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.