Querying for a String inside a Set in Spring Data MongodDB repository

I have Set inside a class as follows:

public class Foo {

   String id;

   Set<String> bars = new HashSet<String>();

I then have the following repository for it:

public interface FooRepository  extends PagingAndSortingRepository<Foo, String>{

   public List<Foo> findByBars(String bar);


The code works fine (all Junits I have for it work) but, unfortunately, I get a compilation warning:

FooRepository.java Parameter type (String) does not match domain class
property definition (Set). Unknown Spring Data Problem

If I change the parameter from “String bar” to “Set< String> bar” the compilation warning goes away. But I do want to query with String and not have to create a Set. Any idea how to resolve?