evanw
04/18/2022, 12:51 PMconversations with column participants of type JSONB (originally JSON but I think it needs to be JSONB) where the structure is something like:
[
"Emily",
"Renee",
"Martina"
]
I'm trying to return an array of all conversations where participants includes the current user, e.g. "Emily".
This is what I've tried, but I'm certain this is wrong:
let { data, error, status } = await supabase
.from('conversations')
.select('id, name, participants')
.contains('participants', ['Emily']);
Any pointers? Or should my data be structured differently? (Future state, participants might be more like [ { name: 'Emily', id: 123 } ] but for right now I'm just trying to sorta learn the basics
The error I'm getting with this is "invalid input syntax for type json"