So, let’s say I have a model Car, and a model Person, with a structures:
%Car{id: "123"}
%Person{
options: "{"car_id":"123"}"
}
options being a text field on the underlying DB.
To fetch that from the database I can use a fragment like:
"JSON_EXTRACT(?, \"$.car_id\")"
It works when using the order_by statement for example, however, when fetching all Persons and joining all the related Cars based on that fragment, it doesn’t…
I tried this, and put that return value on the select
statement to try to debug:
from p in Person,
join: c in Car, on: c.id == fragment("JSON_EXTRACT(?, \"$.car_id\")" p.options),
select: {c.id == fragment("JSON_EXTRACT(?, \"$.car_id\")" p.options), fragment("JSON_EXTRACT(?, \"$.car_id\")" p.options), c.id}
which basically returns [{false, "123", "123"}]
(false on every comparison)
I would be grateful if somebody had a hint for this.