Overview
This node performs an aggregation operation on a specified MongoDB collection using a user-defined aggregation pipeline query. It is useful for scenarios where complex data processing and transformation are needed within MongoDB, such as filtering, grouping, sorting, and reshaping documents. For example, it can be used to aggregate sales data by month or to filter records based on specific criteria.
Use Case Examples
- Aggregating user activity logs to calculate total actions per user.
- Filtering and grouping product data to generate sales reports.
Properties
| Name | Meaning |
|---|---|
| Collection | The MongoDB collection on which the aggregation operation will be performed. |
| Query | The MongoDB aggregation pipeline query in JSON format, defining the stages of the aggregation process. |
Output
JSON
_id- The unique identifier of the aggregated document, if present in the aggregation result.
- Other fields returned by the aggregation pipeline as per the query definition.
Dependencies
- MongoDB database connection with appropriate credentials
Troubleshooting
- Ensure the MongoDB connection credentials are correct and the database exists, otherwise connection errors will occur.
- The aggregation query must be a valid MongoDB aggregation pipeline in JSON format; invalid JSON or pipeline stages will cause errors.
- If the aggregation query references an _id field as a string, it is automatically converted to a MongoDB ObjectId; ensure this matches the database schema.
- If the node is set to continue on fail, errors in the aggregation query will be returned as error messages in the output instead of stopping execution.
Links
- MongoDB Aggregation Pipeline - Official MongoDB documentation explaining the aggregation pipeline stages and usage.