Filter a value from array of strings in Postgres using ecto query

Can someone please guide me here, below is my requirement:-

iex:8> Repo.all(from u in AdminUser, select: u.roles)

This query gives the below result:-
[
[“root”],
[“super”, “transfer”, “operator”],
[“super”, “transfer”, “operator”],
[“super”, “operator”],
[“root”]
]

The below query is working fine to get the count for “root” as 2.
Repo.one(from u in AdminUser, where: u.roles == ^[“root”], select: count("*"))

How to get the count of rows that include ‘super’ among the roles?

where: ^"super" in u.roles

3 Likes

Thanks Fuelen.