MongoDB Ex icon

MongoDB Ex

MongoDB Extended - Advanced MongoDB operations, including support for filters, bulk operations, full update JSON support and more.

Document → Aggregate

AI-generated

Summary

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

Discussion