Open
Description
Feature request
My use case is that I'd like to have the "in" operator but with the function of an "AND". So use-case is - get all posts that have tag1 and tag2 (both)
Table structure
posts (id, title)
post_tag (post_id, tag_id)
tags (id, title)
Is your feature request related to a problem? Please describe.
That's not a problem, I just can't use the feature I would like to have 😅.
Describe the solution you'd like
supabase.from("posts")
.select("*, filterTags:tags!inner(*), tags(*)")
.contains("filterTags.id", "(1, 2)")
Describe alternatives you've considered
Two alternatives I'm considering
- A
rpc
method, but I'd like to dynamically filter my posts - Change the data model so that each post holds an array of tag ids. This looks like a clean solution to me, but it's a trade-off (as always).
Also given the fact, that "in" could be used with embedded resources, I thought it's possible (and nice infor the sake of completeness) for contains as well.
https://supabase.com/docs/reference/javascript/next/filter#filter-embedded-resources