I have a really simple query and I'm trying to get the count.
const query = Product.query()
.withGraphJoined('collections')
.whereIn('collections.id', [1,3]);
I tried resultSize()
, which worked on other queries I made that didn't use withGraphJoined
. The only thing that works is if I do count()
on the query, which returns the following:
Product {
'count(*)': 6,
id: 1,
name: 'product',
slug: 'slug',
price: 32,
}
Is there a cleaner way to do a total count on queries with withGraphJoined
?