Skip to main content

aggregates

Aggregates​

The aggregate function calculates aggregations for a specific attribute of a model. There are different types of aggregations

type description
distinctFinds distinct values
avgCalculates the Average
countCounts all valid entries
groupReturns the data entries grouped by the attribute
maxreturns the "biggest" value
minreturns the "smalles" value
sumcalculates 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