Search code examples
mongodbspring-data-jpaspring-mongo

How to query for elements in a collection in Spring Mongo JPA


I'm using JPA repositories and I see they all have findBy methods. How can I do the equivalent of SQL IN clause e.g. findAll(where field in 'a','b','c')?


Solution

  • findByFieldNameIn(List<String> fieldList);

    This should work fine.

    You can refer this link to learn to build repository methods.