@cbnsndwch/zero-sources

unwind() function

Home > @cbnsndwch/zero-contracts > unwind

unwind() function

Creates an $unwind pipeline stage with advanced options.

Signature:

declare function unwind(options: UnwindOptions): UnwindStage;

Parameters

Parameter

Type

Description

options

UnwindOptions

Unwinding options including path, preserve behavior, and index inclusion

Returns:

UnwindStage

An $unwind stage with full options

Example

const stage = unwind({
    path: '$members',
    preserveNullAndEmptyArrays: false,
    includeArrayIndex: 'memberIndex'
});
// { $unwind: { path: '$members', preserveNullAndEmptyArrays: false, includeArrayIndex: 'memberIndex' } }

How was this page?