Scott P
09/20/2021, 5:35 PMSELECT * FROM my_table WHERE metadata -> 'company' = '65'
The ->
essentially tells it to look inside the contents of the column (metadata
- named before it), and find the property (company
- named after it) that matches the clausejbergius
09/20/2021, 5:36 PMsupabase
.from('subscriptions')
.select('*, prices(*, products(*))')
.in('status', ['trialing', 'active']);
how would I apply the equivalent of the SQL command you just supplied? Mind helping?jbergius
09/20/2021, 5:37 PMScott P
09/20/2021, 5:39 PMJS
supabase
.from('subscriptions')
.select('*,company:metadata->company->65, prices(*, products(*))')
.in('status', ['trialing', 'active']);
jbergius
09/20/2021, 5:39 PM.eq('metadata->company', '65')
?Scott P
09/20/2021, 5:40 PMScott P
09/20/2021, 5:40 PMjbergius
09/20/2021, 5:41 PMScott P
09/20/2021, 5:42 PMjbergius
09/20/2021, 5:43 PM*,company:metadata->company->${test}, prices(*, products(*))
)
.in('status', ['trialing', 'active']);`jbergius
09/20/2021, 5:44 PMScott P
09/20/2021, 5:44 PM75
as a number (i.e remove the quotes), does it still complain?
You might also want to try '"75"'
jbergius
09/20/2021, 5:45 PMScott P
09/20/2021, 5:45 PMjbergius
09/20/2021, 5:45 PMjbergius
09/20/2021, 5:47 PMjbergius
09/20/2021, 5:48 PMsupabase
.from('subscriptions')
.select('*,company:metadata->company->65, prices(*, products(*))')
.in('status', ['trialing', 'active']);
Scott P
09/20/2021, 5:48 PM.eq()
method will work thenjbergius
09/20/2021, 5:52 PMsupabase
.from('subscriptions')
.select('*, prices(*, products(*))')
.in('status', ['trialing', 'active'])
.eq('metadata->company', '75');
refering to the docs it seems like this sholud work, but it dosen'tjbergius
09/20/2021, 5:55 PMconst { data, error } = await supabase
.from('users')
.select(`
id, name,
address->street
`)
.eq('address->postcode', 90210)
silentworks
09/20/2021, 6:04 PM->>
instead of ->
jbergius
09/20/2021, 6:36 PMjbergius
09/21/2021, 5:26 AM.from('subscription_items')
.select('*, subscriptions(metadata) **Here I would like to filter based on metadata->>company')
.in('status', ['active']);