Hi Bubblelers!
There’s a limitation on the current Bubble Data API which I am trying to find a workaround, but so far I did not solve it nicely. The use case:
- Let’s say we have in the database
Fruit.colors, whereFruitis a Thing andcolorsis astring listfield ofFruitcontaining the possible fruit colors. - From our backend I want to retrieve using Bubble Data API the fruits that have at least one color of a color list introduced by the user, let’s say [
yellow,red].
In order to create the search constraint, I could do:
[ { "key": "colors", "constraint_type": "contains", "value": "yelow" }
, { "key": "site", "constraint_type": "contains", "value": "red" } ]
But this search will only return Fruits that have as color yellow AND red.
Another possibility then is to do two calls to Data API, one each with one search constraint I defined above. But this is not scalable when the Thing (in our case the amazing Fruits), has more list fields you want to search for. For example, I want to search fruits that accomplish:
-
Fruits.colorscontains ANY of [yellow,red] -
Fruits.sizecontains ANY of [small,medium]
Thanks in advance!
Opground team