clsMongoGetObjects Step

Use this feature to retrieve one or more documents from a MongoDB collection by applying an optional JSON filter.

Last published at: July 22nd, 2026

Description:

The Get a List of Objects Using a JSON Filter Condition step enables a FlowWright workflow to query a MongoDB collection and retrieve all documents that satisfy a specified JSON filter.

This step is useful when workflow decisions or downstream processing depend on data stored in MongoDB. Rather than retrieving a single document, the step returns a collection of matching objects, making it suitable for reporting, synchronization, integrations, business rules, and data processing scenarios.

The step connects to a configured MongoDB connection, accesses the specified database and collection, optionally applies a MongoDB-compatible JSON filter, and stores the resulting documents as JSON in a workflow variable or global variable.

If no filter is supplied, the step attempts to retrieve all documents from the specified collection.

Typical uses include:

  • Customer record retrieval
  • Audit log queries
  • Product catalog searches
  • IoT device data retrieval
  • Configuration lookups
  • Workflow reporting
  • Integration with external applications

The retrieved JSON can subsequently be processed by custom workflow logic, REST API calls, AI services, scripting steps, document generation, or notification workflows.

 

Inputs

  • Select MongoDB Connection String – Selects the configured MongoDB connection used to access the database.
  • Enter Database Name - Specifies the MongoDB database containing the target collection.
  • Enter Collection Name - Specifies the MongoDB collection to query.
  • Enter JSON Filter to Match Objects - Optional MongoDB JSON filter used to return only matching documents. If left empty, all documents in the collection are retrieved.
  • Variable/Global to Store JSON Objects - Specifies the workflow variable or global variable that will receive the returned JSON array. 
 

 

Returns

  • True – MongoDB query completed successfully and the JSON result set was stored in the specified variable or global variable.
  • False - The query could not be completed because of a connection failure, invalid configuration, invalid filter, missing collection, or another execution error.
 

 

Usage:

The Get a List of Objects Using a JSON Filter Condition step is commonly used whenever workflow logic requires information stored in MongoDB.

During execution:

  1. Connect to the selected MongoDB server.
  2. Open the specified database.
  3. Access the configured collection.
  4. Apply the optional JSON filter.
  5. Retrieve all matching documents.
  6. Store the resulting JSON array in the configured workflow variable or global variable.
  7. Follow either the True or False return path.

A typical workflow might look like this:

 

Typical workflow scenarios include:

  • Retrieving active customer records
  • Searching product inventories
  • Obtaining workflow configuration data
  • Reading application settings
  • Processing IoT telemetry
  • Building dashboard reports
  • Synchronizing data with external systems

 

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 “clsMongoGetObjectsDef” example.          

  • Create a new definition named “clsMongoGetObjectsDef” and open it in designer mode. 
  • Drag “clsMongoCreateObjects, and clsMongoGetObjects” steps to the canvas. 
  • Connect the dots between the “Start” and other steps, as shown above.
  • Define a variable or a global variable to store the JSON path and the objects. 
  • 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 "clsMongoGetObjects" 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. Provide the collection name. Provide the variable or global reference to store the JSON object fetched during execution. 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 "clsMongoGetObjects" step to configure its "Optional" properties. Provide a JSON filter to match the object. Note: This configuration is optional; if left empty, the step will fetch all JSON objects. 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 all the JSON objects have been successfully fetched from MongoDB. 

 

  • Click the process step to view its properties. The “clsMongoGetObjects” step should fetch the JSON objects as configured, as shown below. 

 

Tips:

  • Configure reusable MongoDB connection strings centrally to simplify administration.
  • Use JSON filters to retrieve only the documents required by the workflow, reducing unnecessary processing.
  • Store the returned JSON in a descriptive workflow variable name to improve workflow readability.
  • Validate database and collection names before deploying workflows to production.
  • Route the False path to logging and notification steps for easier troubleshooting.
  • When processing large collections, apply filters to improve performance and reduce memory usage.
  • Combine this step with Loop Each, REST Call, Ask AI, Generate Document, Send Email, or JSON processing steps to build complete data-driven workflows.

 

Notes:

  • A valid MongoDB connection must exist before this step can execute.
  • Database and collection names are case-sensitive according to MongoDB configuration.
  • The JSON filter is optional. When omitted, all documents from the specified collection are retrieved.
  • The returned data is stored exactly as JSON in the specified workflow variable or global variable.
  • Use the True and False return paths to implement appropriate success and error handling.
  • Connection failures, authentication problems, invalid filters, or unavailable collections may cause execution to follow the False path.
  • Execution details and any errors are recorded in the FlowWright workflow execution log.

 

Get a List of Objects Using a JSON Filter Condition vs. Get a Single Object:

Both MongoDB workflow steps retrieve data from MongoDB collections, but they serve different purposes.

Get a List of Objects Using a JSON Filter Condition Get a Single Object
Returns multiple matching MongoDB documents. Returns a single matching MongoDB document.
Stores a JSON array. Stores a single JSON object.
Best suited for reporting, searches, and bulk processing. Best suited for retrieving one specific record.
Commonly used before looping or batch processing. Commonly used when only one document is expected.

As a general guideline:

  • Use Get a List of Objects Using a JSON Filter Condition when multiple documents may satisfy the search criteria.
  • Use a single-object retrieval step when the workflow expects exactly one matching document.

 

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
  • JSON filter
  • Workflow variable or global variable
  • Error handling on the False return path

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"
}
]