I am new about spring boot and mongodb and I have a very simple question.
class A{
private String x;
private String y;
@DBRef
private List<B> listOfB;
... getter ....
... setter ....
}
class B{
private String q;
private boolean status;
}
Query query = new Query();
query.addCriteria(new Criteria("status").is(true));
query.addCriteria(new Criteria("listOfB.$status").is(true));
mongoOperations.find(query, A.class);
I want to retrieve A object with listOfB but listOfB only consists of the value of status = true from MongoDb with spring boot.