I have a entity Document with a list of DocumentValue
@QueryEntity
@Document
public class Document{
private List<DocumentValue> documentValues;
}
DocumentValue can has also a list of DocumentValue
@QueryEntity
public class DocumentValue {
String value;
String name;
String id;
List<DocumentValue> documentValues;
}
I am now trying to do something like
private QDocumentValue getDocumentValuePathByDepth(int depth){
ListPath path = QDocument.document.documentValues;
if (depth != null) {
for (int i = 0; i < depth; i++) {
path = path.documentValues.any();
}
}
}
Does anybody know if its possible to do an eleMatch in that depth?
Like
ListPath<QDocumentValue> query = getDocumentValuePathByDepth(5);
return query.fieldId.eq(documentFilter.getFieldId()).and(query.value.between(from, to));
One element of documentValues in that depth should fulfill both conditions
BR D.C.
elemMatch is supported in Querydsl Mongodb like this
QDocumentValue documentValue = QDocumentValue.documentValue;
query.anyEmbedded(document.documentValues, documentValue)
.on(documentValue.id.eq(documentFilter.getFieldId(),
documentValue.value.between(from, to));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With