title: spring data mongodb find by collection
body: <p>I am using spring-data-mongodb.</p>
  
  <p>Here is my controller method:</p>
  
  <p>Controller:</p>
  
  <pre><code>@RequestMapping(value = "/getByCategory",method = RequestMethod.GET, consumes=MediaType.APPLICATION_JSON, produces=MediaType.APPLICATION_JSON)    
      public Iterable&lt;Node&gt; getByCategory(@RequestParam(value="categories") List&lt;String&gt; categories) throws EntityNotFoundException {
          Iterable&lt;Node&gt; nodes = nodeService.getByCategory(categories);
          return nodes;
      }
  </code></pre>
  
  <p>Here I am passing list of string as a request parameter.</p>
  
  <p>My service method is:</p>
  
  <pre><code>public Iterable&lt;Node&gt; getByCategory(List&lt;String&gt; categories) {
  
          return repository.findByCategories(categories);
      }
  </code></pre>
  
  <p>Repository code:</p>
  
  <pre><code>@RepositoryRestResource
  public interface NodeRepository extends MongoRepository&lt;Node, String&gt; , PagingAndSortingRepository&lt;Node, String&gt;{
  
  
      @Query("{categories:{$in: ?0}}")
      Iterable&lt;Node&gt; findByCategories(List&lt;String&gt; categories);
  
  }
  </code></pre>
  
  <p>Here, my query in repository always returns empty array [].
  I am not getting what is wrong with this query.</p>
  
  <p>My request URL is:</p>
  
  <pre><code>http://localhost:8080/document/getByCategory?categories="category1"&amp;categories="category2"
  </code></pre>