title: How to return list of specific fields in query Java Spring Mongo Repository?
body: <p>I use Java spring and MongoDB repository in my project.</p>
  <p>Here is DTO definition:</p>
  <pre><code>@Document(collection = &quot;Info&quot;)
  public class Info  {
  
    String id,
    Integer count,
    String type
    …
  }
  </code></pre>
  <p>I need to return from the query a list of IDs where the count field not zero and type filed has 'binary' text.</p>
  <p>Here how I try to implement it:</p>
  <pre><code>@Query(value=&quot;{ 'count' : 0, 'type' : 'binary' }&quot;, fields=&quot;{ 'id' : 1 }&quot;)
  List&lt;String&gt; getInfo();
  </code></pre>
  <p>I get this result from query above:</p>
  <pre><code>0={&quot;_id&quot;: {&quot;$oid&quot;: &quot;5eb97a8139d4c62be4d90e4c&quot;}}
  1={&quot;_id&quot;: {&quot;$oid&quot;: &quot;3ec97a8127d4c60cb4d90e9e&quot;}}
  </code></pre>
  <p>And I expect this result:</p>
  <pre><code>{&quot;5eb97a8139d4c62be4d90e4c&quot;, &quot;3ec97a8127d4c60cb4d90e9e&quot;}
  </code></pre>
  <p>So as you can see I expect to get a list of id strings from the query above.</p>
  <p>Any idea what should I change in the query above to get the expected list of ids results?</p>