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
submodule to use its methods:
You can now build the pipeline by calling PipelineBuilder
methods using dot notation. For example, the following code builds a pipeline that filters, groups, and sorts data, with paging configuration: