Skip to main content
Version: 4.52.0

Document Aggregate

The Document Aggregate component allows you to query for documents using an aggregation pipeline.

The aggregation is executed on the documents collection.

An aggregation pipeline consists of one or more stages that process documents:

  • Each stage performs an operation on the collection documents. For example, a stage can filter documents, group documents, and calculate values.
  • The documents that are output from a stage are passed to the next stage.
  • An aggregation pipeline can return results for groups of documents. For example, return the total, average, maximum, and minimum values.
  • Dynamic values in the pipeline are allowed using the dot-notation(see example below).

Stages

Configuration

Inputs | Outputs


Document Aggregate
Input
Output
Finished Output
Error
00 0 (ilysqqcjr)

A valid JSON object containing keys that will be used by HandleBars

in the aggregation pipeline in the configuration.

  • Example: Using stages $match and $group to calculate the number of files and total size for the corresponding binary documents. Incoming message:
  • {
    kind: "BINARY";
    }

    Dynamic values can be used in the aggregation, referenced with {{key}} as in the example below with kind.

    Configuration aggregation:

     [
    {
    $match: {
    kind: "{{kind}}",
    },
    },
    {
    $group: {
    _id: "$source.extension",
    count: { $sum: 1 },
    totalSize: { $sum: "$source.byteSize" },
    },
    },

    ];