aggregates
Aggregates​
The aggregate
function calculates aggregations for a specific attribute
of a model. There are different types of aggregations
type | Â description |
---|---|
distinct | Finds distinct values |
avg | Calculates the Average |
count | Counts all valid entries |
group | Returns the data entries grouped by the attribute |
max | returns the "biggest" value |
min | returns the "smalles" value |
sum | calculates the sum of all valid data entries |
// Example for aggregating distinct values
const distinctMasterCategories = dcupl.fn.aggregate({
modelKey: 'Style',
options: {
attribute: 'masterCategory',
types: ['distinct'],
distinctOptions: {
limit: 10,
skipKeys: false,
},
},
});
info
Try it out yourself in the Playground