Description:
This step creates the JSON objects in the Mongo DB.
Inputs
- connID – select Mongo DB connection string
- dbName - provide the database name
- collectionName - provide collection name
- jsonData - provide multiline JSON data
- filePath - provide external JSON file path
Returns
- True – step executed successfully
- False - step failed to execute
Usage:
Prerequisite:
Navigate to the Integration - Connections page. Create a new MongoDB connection string as below. Click the Test button to validate the connection response.
Example:
Let’s build and execute the “clsMongoCreateObjectsDef” example.
- Create a new definition called “clsMongoCreateObjectsDef”
- Select the definition and click the “design” button
- Drag the “clsMongoCreateObjects” step from the toolbox
- Connect the dots between the Start and “clsMongoCreateObjects” as above
- Define variables/globals required for the execution
- Click the "clsMongoCreateObjects" step to configure its "Settings" properties. Provide a name to the step. Select the MongoDB connection string from the drop-down list. Provide the database name. Provide the collection's name. Click the Save button.
- Click the "clsMongoCreateObjects" step to configure its "Advanced" properties. Provide the JSON data as multiline as below. You may provide the server path information to a file containing the JSON data as an option. Note: Use either one input field to provide the JSON data and not both.
- The “Logging” setting configuration is necessary for documentation and also measures the workflow progress and the percent complete. This is achieved by configuring the step state and percent fields individually, as shown in the images below. Configure the “Logging” using the following properties.
- Save the process definition, create a new instance, and execute. Render the process instance. The instance status “Completed” indicates the JSON object has been created successfully in the MongoDB.
- Click on the process step to view its properties. The “clsMongoCreateObjectsDef” step should render the status “Complete” and return the value “True,” as below.
Definition Sample:
You may download the sample definition(s) from the link here and later import it (drag-drop) to your FlowWright Process Definition (XML file) or Form Definition (HTML file) page.
NOTE: Please verify and complete the process steps for any missing configurations, such as file path references and database connections after import. Then, save the definition to confirm the changes.
Click here to download the sample file.
The sample JSON data is included here for reference.
[{
"empNo":"7369",
"eName":"SMITH",
"designation":"CLERK",
"manager":"7902",
"hire_date":"12/17/1980",
"salary":"800",
"deptNo":"20"
},
{
"empNo":"7499",
"eName":"ALLEN",
"designation":"SALESMAN",
"manager":"7698",
"hire_date":"02/20/1981",
"salary":"1600",
"deptNo":"30"
},
{
"empNo":"7521",
"eName":"WARD",
"designation":"SALESMAN",
"manager":"7698",
"hire_date":"02/22/1981",
"salary":"1250",
"deptNo":"30"
},
{
"empNo":"7522",
"eName":"DESMOND",
"designation":"SALESMAN",
"manager":"7698",
"hire_date":"02/23/1981",
"salary":"1250",
"deptNo":"30"
}
]