title: How do I retrieve particular List of element from MongoDB?
body: <p>I want to retrieve particular list of element from the Mongodb Table.</p>
  
  <p>Lets suppose i have two variables in my Employee class-:</p>
  
  <pre><code>public Class Employee
  {
  private String Id;
  private String Name;
  .
  .
  </code></pre>
  
  <p>now when i will make the fetch query it will be something like -:</p>
  
  <pre><code>List&lt;Employee&gt; list=mongoTemplate.findAll();
  </code></pre>
  
  <p>and then i will loop through each employee object to fetch the employee ID and save in the <code>List&lt;String&gt;</code></p>
  
  <p>Now, I want the solution in such a way that i can retrieve all the ID's in one go.Something like-:</p>
  
  <pre><code>List&lt;String&gt; employeeId = someCodeHere; 
  </code></pre>
  
  <p>Please help if you can</p>
  
  <p>Thanks in advance.</p>