Hi, folks,
I see there are some old topics about this, but apparently no direct answer for them. I need to query some data from a Mongo database and I'm using Morphia API in the whole project, so I wouldn't like to change. My collection has lots of documents with repeated value for a specific field, and I need to retrieve only one document for each of this field's values. I know that MongoDB has an API that provides .distinct(String field) which is exactly what I need, but adapted to my Morphia queries. Is there any way to do this using Morphia? The closer I could get to an answer was by using aggregation, but it is not very clear for me yet.
Thanks in advance!