Adapter for MongoDB 9.12 | webMethods Adapter for MongoDB Documentation | webMethods Adapter for MongoDB Installation and User’s Guide Documentation | Adapter Services | Configuring Aggregate Query Service
 
Configuring Aggregate Query Service
An Aggregate Query service runs aggregate operations on MongoDB collection. This service follows the concept of data processing pipelines.
Refer the section Before Configuring or Managing Adapter Services before configuring adapter services.
*To configure Aggregation service
1. In Designer, right-click the package which contains the service and select New > Adapter Service.
2. Select the parent namespace, type a name for the adapter service, and click Next .
3. Select Adapter for MongoDB as the adapter type and click Next.
4. Select an appropriate Adapter Connection Name and click Next.
5. From the list of available templates, select the Aggregate Query template and click Finish.
The adapter service editor for the adapter service appears. You can select the Adapter Settings tab at any time to confirm adapter service properties such as the Adapter Name, Adapter Connection Name , and Adapter Service Template .
6. Use the Aggregation tab to configure the collection the operation accesses using the following fields:
The Collections drop-down list the collections available in the specified Database and pick the appropriate collection from the list.
a. Use the icon to create new rows as needed. You can use the icon to fill in all rows to the top table:
Field
Description/Action
Stage
Lists various aggregation pipeline stages.
Query
Queries corresponding stages.
b. Use the icon to create new rows as needed. You can use the icon to fill in all rows to the following table:
Field
Description/Action
Variable
Considers any variable name provided in a Query as a variable. If the Query contains ${<var-name>} then var-name will considered as variable.
Variable Type
MongoDB data types of the Variable.
Note:
If the variable type is BSON, the query input for the variable should be a JSON string.
Input Type
Specifies Java data types of the Variable.
Document Fields
Output document field name that you want to use.
Field Type
Specifies the MongoDB data type for Document Fields.
Output Field
Name of the output field based on the Document Fields.
Output Field Type
Specifies the Java data type.
7. From the File menu, select Save.
Refer to the following example to understand the Aggregate Query service using the query:
a. The following image shows the sample aggregate query used in MongoDB:
b. The following image shows the Aggregate Query service configuration with required stages:
c. The following image shows $match and $group related queries supplied at runtime: