** (Ecto.Query.CastError) issue

I’m trying to delete the record after fetching the record from its uuid

(from oi in OrderItem, where: oi.id == ^id, join: o in Order, where: o.number == ^number) |> Repo.one() |> Repo.delete()

But when I’m passing this in the controller it’s giving me this

** (Ecto.Query.CastError) l value "1323" cannot be dumped to type :binary_id in query

how do I fix this?

Where does "1323" come from?

It looks like your oi.id field is a binary ID, and the ^id you are passing is a string.

If you check the source of ^id, it should look like 559e6361-2bcf-4f9b-89f1-6421883bc2bf

1 Like

ahh. got it. I was using id instead of a string.