Hello. I'm fairly new to QueryDSL and I don't know how to do this.
I need to create a Predicate that is true if a collection of children Documents in my Document (I'm using mongo) has id="foo" and role="bar".
I've thought about doing the following (which I'm guessing won't work):
QDepartmentDocument
departmentDocument = QDepartmentDocument.departmentDocument;
BooleanBuilder builder = new BooleanBuilder();
builder.and(departmentDocument
.employees.any().id.eq("foo"));
builder.and(departmentDocument.employees.any().role.eq("bar"));
builder.build();
I'm building this Predicate in order to send it to a Spring repository implementing QuerydslPredicateExecutor.
The problem with my approach is that it will be true if there is an employee with id=foo and a different employee with role=bar, I'm guessing. I need it to be true only when there is an employee that matches both.
I tried exploring the documentation to no avail.