title: How do I get distinct fields from MongoRepository/QueryDSL?
body: <p>My Document is</p>
  
  <pre><code>@QueryEntity @Data @Document(collection = "MyCol") public class MyCol {
      @Id private String _id;
      private     String version;
  </code></pre>
  
  <p>I want to get all distinct version stored in the db.</p>
  
  <p>My attempts:</p>
  
  <pre><code>public interface MyColDao extends MongoRepository&lt;MyCol, String&gt;, QueryDslPredicateExecutor&lt;MyCol&gt; {
      @Query("{ distinct : 'MyCol', key : 'version'}")
      List&lt;String&gt; findDistinctVersion();
  }
  </code></pre>
  
  <p>Or just findDistinctVersion without the query annotation.</p>
  
  <p>Most of the examples of github have a By-field like</p>
  
  <pre><code>  List&lt;Person&gt; findDistinctPeopleByLastnameOrFirstname(String lastname, String firstname);
  </code></pre>
  
  <p>I don't need a By field.</p>
  
  <p>Another example I found <a href="https://github.com/rgrbev/Twitchable/blob/302b1066c5be8293ad3aae8904df8e348957f1f8/src/main/java/com/twitchable/project/repository/ChannelRepository.java" rel="nofollow">here</a>.</p>
  
  <pre><code>@Query("{ distinct : 'channel', key : 'game'}")
  public JSONArray listDistinctGames();
  </code></pre>
  
  <p>This doesn't seem to work for me.</p>
  
  <p>I can't seem to find queryDSL/Morphia's documentation to do this.</p>