I would like to know how to write a query which helps me in getting the number of types of items bought by each customer. I would like to know this for and every customer.
did_order : [uid] (order)
order.customer : uid (customer)
order.item : uid (item)
- item.name // examples :- apple or orange or pen …
each customer can place any number of orders, each order can have any number of items in it. There won’t be any duplicate items in each order and no facets or so to mention the quantity of the item purchased. Please assume the quantity to be one always. Finally, I would like to count the number of Distinct types of items bought by every customer. i.e :- please start the root with has(customer.name) instead of eq(customer.name,xxx).
P.S :- this is a scale-down of our use case which has abt 6 different types of entities and such. Please ignore any non-ideal schema declaration practices if any.