how would one to many work? If i want to get a sto...
# javascript
x
how would one to many work? If i want to get a storypost along with its comments
s
It depends how your database is setup, but let's assume you have tables
stories
,
post_comments
and
post_reactions
. Each row in
post_comments
and
post_reactions
would have a column called
story_id
which would have a relation to
stories.id
. Then, you should be able to do something like this:
Copy code
js
const { data, error } = await supabase
  .from('stories')
  .select(`
    *,
    post_comments:story_id ( * ),
    post_reactions:story_id ( * )
  `)
x
I see it would have an array then
2 Views