@cbnsndwch/zero-sources

UnwindStage interface

Home > @cbnsndwch/zero-contracts > UnwindStage

UnwindStage interface

Array unwinding stage - equivalent to MongoDB's $unwind operator.

Deconstructs an array field from input documents to output a document for each element. Each output document is the input document with the array field replaced by the element.

Signature:

interface UnwindStage<T = Dict>

Example

// Simple unwinding
{ $unwind: '$members' }

// With options
{ $unwind: {
  path: '$members',
  preserveNullAndEmptyArrays: false,
  includeArrayIndex: 'memberIndex'
}}

Properties

Property

Modifiers

Type

Description

$unwind

keyof T | UnwindOptions

How was this page?