Closed silva96 closed 2 years ago
Hey, I wonder if this is possible, I register events for "products" using a property in the jsonb called: product_id
I would love to return events for products 1 and 2, for example
Ahoy::Event.where_event('Product View', product_id: [1, 2])
Reading the code, I see you just dump the properties as json and match with @> so the array wont work in this case, any ideas of how can I achieve this?
@>
Regards
Hey @silva96, you can use or:
or
Ahoy::Event.where_event('Product View', product_id: 1).or(Ahoy::Event.where_event('Product View', product_id: 2))
Or write custom SQL
Hey, I wonder if this is possible, I register events for "products" using a property in the jsonb called: product_id
I would love to return events for products 1 and 2, for example
Reading the code, I see you just dump the properties as json and match with
@>
so the array wont work in this case, any ideas of how can I achieve this?Regards