PricingDocsAcademy
Bluesky ...
Fri, Dec 13, 9:47 AM

JSON data filters with Supabase

  • /attachments/1305865587284508752/1305865587750342748/image.png

    saillmone

    1 month ago

    Hi everyone !

    I have filter problems with JSON data with supabase.

    I'm trying to push supabase a little further than a simple table but I'm finding myself having difficulty.

    My API call without filter returns me the data. But as soon as I want to make a filter on the JSON "collections", impossible. I have a status code 200 but an empty response.


    "products_collections_variants?select=title,collections&collections->>slug=eq.incontinence"

    Can anyone guide me?

    Thank you!
    image.png
    image.png
    image.png
  • Tod

    1 month ago

    Great energy @saillmone! Your continuous contribution to the toddle Community just made you advance to Community Level 1!
  • saillmone

    1 month ago

    I thought maybe I had to pass an Edge Functions to make the javascript calls directly but I got exactly the same result: empty data without error code.

    If anyone has had this problem or can answer me, I'm interested, thank you! πŸ™Œ
  • /attachments/1305865587284508752/1305951460655366174/image.png

    StuartM

    1 month ago

    I see two things.
    1. You need to put the query separately from the select. Something like this products_collections_variants?and=(collections->>slug.eq.incontinence)&select=*
    2. You have an array in your collections field so if that is expected you need to target a particular item/index in the json path.

    Now for the plug - I figured this out by building a query visually in Comnoco and then seeing what it constructed by looking at the debug logs.
    image.png
    image.png
  • saillmone

    1 month ago

    Thanks for your feedback, i’m now able to get the correct data !

    I just took a look at comnoco (good job). If I understand correctly its usefulness, it is to facilitate api calls to supabase? what about the response time?
    πŸ‘1
  • StuartM

    1 month ago

    It's a backend visual language so it allows you to build visual logic, APIs, scheduled tasks etc and connect to any database. Like Xano but made to work with any database and auth.
    You don't need a backend to do simple CRUD calls to Supabase protected by RLS, Comnoco is for backend logic - like a visual way to build logic and secure API connectivity instead of edge functions.
  • saillmone

    29 days ago

    I just succeeded by creating database functions and calling them via API...

    Thank you for your feedback (I'll keep an eye on comnoco, the day there are more docs it will be crazy!)
  • StuartM

    29 days ago

    Oh cool, well done, as you pointed out, a few more docs and videos will help a lot, they are coming!
    πŸ”₯1
  • yoelfdz

    29 days ago

    Hey @saillmone ! I wish I discovered Comnoco sooner, it's definitely worth checking out especially if you're coming from Toddle. There are many similarities, and the trifecta of Toddle, Comnoco, and Supabase is πŸ‘ŒπŸΌ. Would be happy to connect and share insights on this if you decide to use it
    πŸ”₯1
    ❀️1

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code β€” but accessible to your entire team!

Try toddle β€” it's free!

Β© Copyright 2024 toddle. All rights reserved.