Aggregate operators on relations
lroal opened this issue · 0 comments
lroal commented
- count
- sum
- avg
- exists
- min
- max
const order = await db.order.getById(1, {
lineCount: x => x.count(x => x.lines)
});
console.dir(order.lineCount);
With filter
const order = await db.order.getById(1, {
lineCount: x => x.count(x => x.lines, {
lines: {
where: x => x.product.contains('broomstick'),
limit: 20,
orderBy:
}
})
});
console.dir(order.lineCount);