The PipelineBuilder methods allow you to build an aggregation pipeline to process data items through a series of stages. You can configure stages to filter, group, sort, or reshape your data and add paging configuration.
Build a pipeline by calling the pipelineBuilder() method, and configure it by chaining PipelineBuilder methods. Once configured, call the build() method to build it. Finally, specify the pipeline as the pipeline parameter of the aggregatePipeline() method.
Learn more about pipeline stages.
Note: You can only build an aggregation pipeline for collections created in the CMS or with the Data Collections API. They cannot be used on Wix app collections or external collections.
To access PipelineBuilder methods:
Set up the @wix/data package and import it in your code:
Deconstruct the pipelineBuilder and stages submodules to access their methods:
You can now build the pipeline by calling pipelineBuilder() and chaining PipelineBuilder methods. For example, the following code builds a pipeline with stages that filter, group, and sort collection data, and adds paging configuration: