I want to find a Type document by the code of job and by the list of code of category, i tried the below query but it didn't work
@Document
public class Type {
@Id
private String id;
@DBRef
private Job job;
@DBRef
private List<Category> categories;
}
public class Job {
@Id
private String id;
private String code;
}
public class Category {
@Id
private String id;
private String code;
}
public interface TypeRepository extends MongoRepository<Type, String> {
@Query("{ 'job.code': ?0, 'category.code': { $in: ?1 }}")
Type findByJobAndCategoriesCode(String codeJob, List<String> codeCategories);
}