$documents

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: Pipeline stages

What it does

Introduces literal documents in supported aggregation contexts.

Syntax

{$documents: [document, ...]}

Use case

Synthetic pipeline input.

$documents: practical example
{ $documents: [{ x: 1 }, { x: 2 }] }
💡 Explanation Introduces literal documents in supported aggregation contexts. When to use it Synthetic pipeline input.
Key Takeaways
  • Introduces literal documents in supported aggregation contexts.
  • Typical use: Synthetic pipeline input.