How i can translate this basic sentence to mongotemplate or mongorepository I need find all distinct names in collection user
db.user.distinct('name');
@Document(collection = "user")
public class User {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Sample Json
{
"_id" : "12358",
"name" : "HiMan",
"description" : "sales category",
}
{
"_id" : "791127",
"name" : "HiMan",
"description" : "",
}
{
"_id" : "123123",
"name" : "Rango",
"description" : "sales Rango",
}
And i get: [ "Rango", "HiMan" ]