unwind() function
Home > @cbnsndwch/zero-contracts > unwind
unwind() function
Creates an $unwind pipeline stage for deconstructing array fields.
This is equivalent to MongoDB's $unwind aggregation operator. Outputs one document for each element in the specified array field.
Signature:
declare function unwind(path: string): UnwindStage;Parameters
Parameter
Type
Description
path
string
Path to the array field (e.g., '$members')
Returns:
An $unwind stage with simple path
Example
const stage = unwind('$members');
// { $unwind: '$members' }How was this page?