clsMongoCreateObjects Step

Use this feature to create one or more JSON documents in a MongoDB collection.

Last published at: July 22nd, 2026

Description:

The Create JSON Objects in MongoDB step enables a FlowWright workflow to insert JSON documents into a MongoDB collection.

This step is commonly used when workflow execution needs to create new business records, synchronize data with external applications, archive workflow information, or populate MongoDB collections with structured JSON data.

The step connects to a configured MongoDB database, opens the specified collection, and inserts one or more JSON documents supplied either directly within the workflow configuration or from an external JSON file. This flexibility allows workflows to generate JSON dynamically or reuse existing JSON files produced by previous workflow steps or external applications.

Typical uses include:

  • Creating customer records
  • Inserting order documents
  • Archiving workflow data
  • Importing application configuration
  • Recording audit events
  • Synchronizing external business systems
  • Populating reporting or analytics databases

Once the documents are successfully inserted, workflow execution continues along the True return path.

 

Inputs

  • Select MongoDB Connection String – Selects the configured MongoDB connection used to access the database.
  • Enter Database Name - Specifies the MongoDB database that contains the target collection.
  • Enter Collection Name - Specifies the MongoDB collection where the JSON documents will be inserted.
  • Enter JSON Data (multiline) - Specifies one or more JSON documents entered directly within the workflow step.
  • Enter JSON File Path (if external) - Specifies the path to an external JSON file containing the documents to insert.

Note: The XML definition allows either inline JSON data or an external JSON file path. Depending on the workflow design, one or both properties may be used.

 

 

Returns

  • True – The JSON document(s) were successfully inserted into the specified MongoDB collection.
  • False - The insert operation failed because of a connection problem, invalid configuration, malformed JSON, inaccessible file, or another execution error.
 

 

Usage:

The Create JSON Objects in MongoDB step is typically used whenever a workflow needs to create new MongoDB documents.

During execution:

  1. Connect to the selected MongoDB server.
  2. Open the specified database.
  3. Access the configured collection.
  4. Read the JSON data from either the multiline configuration or the specified external JSON file.
  5. Insert the JSON document(s) into the MongoDB collection.
  6. Follow either the True or False return path depending on the execution result.

A typical workflow might look like this:

 

Typical workflow scenarios include:

  • Creating customer profiles
  • Inserting purchase orders
  • Recording workflow audit events
  • Storing AI-generated responses
  • Archiving completed workflow data
  • Importing configuration records
  • Synchronizing business information with MongoDB

 

Prerequisite:

Navigate to the Integration - Connections page. Create a new MongoDB connection string as shown below. Click the Test button to validate the connection response. 

 

 

Example:

Let’s build and execute the “clsMongoCreateObjectsDef” example.          

  • Create a new process definition called “clsMongoCreateObjectsDef” and open the definition in designer mode. 
  • Drag the “clsMongoCreateObjects” step to the canvas.
  • Connect the dots between the “Start” step and “clsMongoCreateObjects” steps, as shown above.
  • Define a variable or a global variable to store the result.
  • Click the "clsMongoCreateObjects" step to configure its "Required" properties. Provide a name for the step. Select the MongoDB connection string from the drop-down list. Provide the database name and the collection name. Click the Save button. Note: Click the "AI Predict" button for the Copilot to add new process steps that match your process description. 

 

  • Click the "clsMongoCreateObjects" step to configure its "Optional" properties. Provide the JSON data as a multiline string as shown below. You may also provide the server path to a file containing the JSON data. Note: Use only one input field to provide the JSON data, not both. Click the Save button. 

 

  • The “Logging” configuration is necessary for documentation and also measures workflow progress and percent complete. This is achieved by configuring the step state and percent fields individually, as shown below. Configure the “Logging” using the following properties.

 

  • Save the process definition, create a new instance, and execute it. Render the process instance. The instance status “Completed” indicates that the JSON object has been created successfully in MongoDB. 

 

  • Click the process step to view its properties. The “clsMongoCreateObjectsDef” step should display the status “Complete” and return the value “True,” as shown below.   

 

Tips:

  • Validate JSON syntax before deploying the workflow.
  • Store reusable JSON templates in external files when multiple workflows share the same document structure.
  • Use workflow variables to dynamically generate JSON before calling this step.
  • Ensure the target MongoDB collection exists and that the configured connection has write permissions.
  • Route the False path to logging and notification steps to simplify troubleshooting.
  • Use descriptive collection names that reflect the business data being stored.
  • Combine this step with REST Call, Generate JSON, Ask AI, Get a List of Objects Using a JSON Filter Condition, Update JSON Objects in MongoDB, or Send Email steps to build complete MongoDB-based workflow solutions.

 

Notes:

  • A valid MongoDB connection must be configured before this step can execute.
  • Database and collection names should correspond to existing MongoDB objects.
  • JSON may be supplied directly within the workflow or loaded from an external file.
  • Invalid JSON syntax or inaccessible files may cause execution to follow the False return path.
  • The True and False return paths should always be used to implement appropriate success and error handling.
  • The step performs insert operations only; it does not modify existing documents.
  • Execution details, insert status, and any errors are recorded in the FlowWright workflow execution log.

 

Create JSON Objects in MongoDB vs. Update JSON Objects in MongoDB:

Both MongoDB workflow steps write data to MongoDB collections, but they serve different purposes.

Create JSON Objects in MongoDB Update JSON Objects in MongoDB
Inserts new JSON documents into a collection. Modifies existing JSON documents in a collection.
Accepts JSON data entered directly or from an external JSON file. Requires both a JSON filter and a JSON update expression.
Used to create new business records. Used to modify existing business records.
Performs insert operations. Performs update operations on matching documents.

As a general guideline:

  • Use Create JSON Objects in MongoDB when the workflow needs to insert new documents into a MongoDB collection.
  • Use Update JSON Objects in MongoDB when existing documents must be modified based on specified search criteria.

 

Definition Sample:

You may download the sample workflow definition from the link provided and import it into your FlowWright environment.

Note: Verify and complete any missing configuration after importing the sample, including:

  • MongoDB connection string
  • Database name
  • Collection name
  • Inline JSON data or external JSON file path
  • File accessibility (when using an external file)
  • Success and error handling
  • Workflow branching

After verifying the configuration, save and publish the workflow before execution.

Click here to download the sample file.

The sample JSON data is provided 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"
}
]