Average of a numeric attribute
avg Method
The method used to get the average in a model attribute. A find criteria can be used to filter before finding an average.
the attribute must be of type number
Usage
const avg = await User.avg("age");
// Do something with avg
const avg = await User.avg("age", { age: { $gt: 12 } });
// Do something with avg
Please refer to the find methods for the operators that can be implemented in the criteria.