-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Labels
Description
I am trying to query the distinct values of a field in all the documents as in:
https://docs.mongodb.com/manual/reference/method/db.collection.distinct/
I tried to use the distinct function provided by Ecto (https://hexdocs.pm/ecto/Ecto.Query.html#distinct/3), but I have the following error:
** (Ecto.QueryError) MongoDB adapter does not support distinct clause in this query in query
Here is the code I try to run:
def list_tags do
query =
from(
a in Dataset,
distinct: :tags
)
query
|> Repo.all()
end
If the distinct function is not supported by the adapter, is there any other way to get the distinct values of a field?
Thanks!