Is it possible to filter on joined collection fiel...
# community-help
r
Is it possible to filter on joined collection fields? To be more specific, on aggregated values of joined collection attributes? I have a customer collection and an order collection. While search the customer collection, I join on the order collection to show amount of orders, total value, etc, in the frontend (orders are included using
strategy: nest_array
). Is it possible to somehow filter for example, customers with total order value > X ?
h
Yes, it is possible. You can specify
$JoinCollName(<filter_by>)
in the
filter_by
. Like
Copy code
$customer_product_prices(customer_id:=customer_a && custom_price:<100)
in this example https://typesense.org/docs/27.1/api/joins.html#specialized-example
Just reread your query. Aggregation is not possible in the filter_by.
r
My best option would be storing the aggregated values directly in the customer collection then I guess
h
Yes.