PipelineMappingBuilder class
Home > @cbnsndwch/zero-contracts > PipelineMappingBuilder
PipelineMappingBuilder class
Builder pattern for constructing pipeline-based table mappings fluently.
Provides a chainable API for building complex pipeline configurations.
Signature:
declare class PipelineMappingBuilder<T>Example
const mapping = pipelineBuilder<IAccountMember>('accounts')
.match({ bundle: 'ENTERPRISE' })
.unwind('$members')
.match({ 'members.role': { $in: ['admin', 'owner'] } })
.addFields({
isOwner: { $eq: ['$members.role', 'owner'] }
})
.projection({
_id: { $concat: ['$_id', '_', '$members.id'] },
accountId: '$_id',
userId: '$members.id',
name: '$members.name',
role: '$members.role',
isOwner: 1
})
.build();Constructors
Constructor
Modifiers
Description
Constructs a new instance of the PipelineMappingBuilder class
Methods
Method
Modifiers
Description
Adds an $addFields stage to compute new fields
Builds and returns the final pipeline mapping configuration
Adds a $match stage to filter documents
Adds a $project stage to reshape documents at any point in the pipeline
Sets the projection for the final output
Adds an $unwind stage to deconstruct an array field
How was this page?