Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filtering on embedded table #30

Closed
jmuzina opened this issue Dec 17, 2024 · 1 comment
Closed

Add filtering on embedded table #30

jmuzina opened this issue Dec 17, 2024 · 1 comment

Comments

@jmuzina
Copy link

jmuzina commented Dec 17, 2024

Currently, when performing a query that filters off of an embedded table, if no records in the embedded table match a filter, Null is returned for the embedded table object.

// returns Customer {customer_id: 2, orders: Null}
let records = client
    .from("customers")
    .eq("customer_id", "2")
    .eq("orders.price", "20")
    .count()
    .execute()
    .await;

A helpful use case would be to exclude records that do not have a match in their embedded table for that query. Perhaps something like this:

// returns Customer {customer_id: 2, orders: Null}
let records = client
    .from("customers")
    .eq("customer_id", "2")
    // add a boolean param that excludes records from `customers` that don't have a an order with price of 20
    .eq("orders.price", "20", true)
    .count()
    .execute()
    .await;

See also: supabase/postgrest-js#197

@jmuzina
Copy link
Author

jmuzina commented Dec 17, 2024

Disregard, this can be done with !inner supabase/postgrest-js#197 (comment)

@jmuzina jmuzina closed this as not planned Won't fix, can't repro, duplicate, stale Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant