I have two models:
@Document('note')
public class Note {
//fields...
@DBRef(lazy = true)
private List<Label> labels = new ArrayList<>();
}
@Document('label')
public class Label {
@Id
private String id;
private String name;
}
I've tried this query but it doesn't work:
@Query(value = "{ 'labels.$id': ?0) }", fields = "{'_id': 1}")
Slice findNotesByLabelName(String id, Pageable pageable);
How can I query all Notes by Label id?