v3.8.0
Aggregate operators
const orders = await db.order.getAll({
numberOfLines: x => x.count(x => x.lines.id),
totalAmount: x => x.sum(x => x.lines.amount),
minAmount: x => x.min(x => x.lines.amount),
maxAmount: x => x.max(x => x.lines.amount),
avgAmount: x => x.avg(x => x.lines.amount),
});