Comment on page
This example Data Stream demonstrates how to use the Action Agent to write business data to a table in a MongoDB database.
Drag the MongoDB Action Agent onto the canvas and rename it. Link the input endpoint to the event data and the output to the printer. Save the Data Stream.
Select the Agent and click Configure. In this case, keep the default Collection.
Enter the Authentication details of the MongoDB database to which you want to connect: server, port number, and authentication type. In this case, leave the authentication type as Anonymous.
Select the database and table/collection. In this case, select the Appdb database and Business table/collection.
Apply the changes and save the Data Stream.
Select the MongoDB Action Agent's input arrow and click Configure. Map one of the parent Agent's output attributes to each input attribute, which is fetched from the MongoDB table.
In this case, click Auto Map to map those with the same name and data type; and manually select the rest.
Apply the changes, save the Data Stream, and publish it.
Click the Live Data View button. Observe the business data is printed, as well as posted to MongoDB.
Let's look at MongoDB. Observe the business data were successfully written to the business table.