The properties used in the sort.
A WeivDataAggregate
cursor representing the refined aggregation.
A WeivDataAggregate
cursor representing the refined aggregation.
A WeivDataAggregate
cursor representing the refined aggregation.
The properties used in the sort.
A WeivDataAggregate
cursor representing the refined aggregation.
The filter to use to filter out items from being used in the aggregation.
A WeivDataAggregate
cursor representing the refined aggregation.
Rest
...propertyName: K[]The property or properties to group on.
A WeivDataAggregate
cursor representing the refined aggregation.
The number of items or groups to return.
A WeivDataAggregate
cursor representing the refined aggregation.
A WeivDataAggregate
cursor representing the refined aggregation.
A WeivDataAggregate
cursor representing the refined aggregation.
Optional
options: WeivDataAggregateRunOptionsOptions to use when running an aggregation.
Fulfilled - A Promise that resolves to the results of the aggregation. Rejected - Error that caused the aggregation to fail.
The number of items or groups to skip in the aggregation results before returning the results.
A WeivDataAggregate
cursor representing the refined aggregation.
Rest
...stage: PipelineStage[]A WeivDataAggregate
cursor representing the refined aggregation.
A WeivDataAggregate
cursor representing the refined aggregation.
Description
Returned aggregation cursor of WeivData. Add filters, lookups (joins) and more when aggregating data.
Welcome to
weivData.aggregate
function of weiv-data library. This feature/function allows you to perform calculations on your database collections data. You can use aggregate with any collection! Read documentation to learn from examples.Note: Unlike wix-data in weiv-data order of methods matters, if you put filter method at the begining of aggregation it'll first filter the documents and then pass to next stage, if you pass filter method after grouping then it'll act like wix-data's having method and filter the results after grouping stage. There are some optimizations made about ordering for example .limit and .skip order doesn't matter but it's always better to keep the methods order in a meaningful way so you can control the aggregation more and even optimize it with this control.
You can also use .addStage method to add any type of stage to aggregation that mongodb driver allows in this way you can mix the default methods which works similar/same with wix-data and also native methods that mongodb provides!
Example