I want to do a query that gives me back the number of car dealers that have cars on stock. If I do a simple query to see the total number of dealers:
query: gql`query {
dealersConnection {
aggregate {
count
}
}
}`,
It gives me back 56 (that is the total number of dealers I have in my db)
But if I do a query based on a related field cars in order to know just the number of dealers that have cars on stock
query: gql`query {
dealersConnection(where: { cars: {available_for_sale: true}}) {
aggregate {
count
}
}
}`,
It gives me back 144. This is the total number of cars available for sale that I have in my db (but not the number of dealers with cars available for sale). What am I doing wrong here?