Actions12
- Search Index Actions
- Document Actions
Document → Aggregate
AI-generatedSummary
Aggregates documents from a MongoDB collection using a pipeline query.
Inputs
- collection (required) — MongoDB Collection to query
- query (required) — Aggregation pipeline expressed as a JSON array of stages
- options — Optional settings such as timeout, maxTimeMS, and hint
Output shape
array of items each containing a json field with the aggregated document and a pairedItem field with execution metadata
Each entry returns the aggregated document; errors may add an
errorfield when continueOnFail is enabled
Examples
Example 1: Count documents older than 1950
collection: "orders", query: [{ "$match": { "year": { "$gt": 1950 } } }], options: {}
Example 2: Insert multiple documents
collection: "items", query: [{ "$match": {} }], options: { many: true, document: [{ "name": "A" }, { "name": "B" }] }