我有一个包含DocumentValue列表的实体文档
@QueryEntity
@Document
public class Document{
private List<DocumentValue> documentValues;
}DocumentValue还可以包含DocumentValue的列表
@QueryEntity
public class DocumentValue {
String value;
String name;
String id;
List<DocumentValue> documentValues;
}我现在正在尝试做一些像这样的事情
private QDocumentValue getDocumentValuePathByDepth(int depth){
ListPath path = QDocument.document.documentValues;
if (depth != null) {
for (int i = 0; i < depth; i++) {
path = path.documentValues.any();
}
}
}有没有人知道有没有可能做这么深的eleMatch?
喜欢
ListPath<QDocumentValue> query = getDocumentValuePathByDepth(5);
return query.fieldId.eq(documentFilter.getFieldId()).and(query.value.between(from, to));该深度中的一个documentValues元素应该同时满足这两个条件
BR D.C.
发布于 2013-12-16 23:43:38
Querydsl Mongodb支持elemMatch,如下所示
QDocumentValue documentValue = QDocumentValue.documentValue;
query.anyEmbedded(document.documentValues, documentValue)
.on(documentValue.id.eq(documentFilter.getFieldId(),
documentValue.value.between(from, to));https://stackoverflow.com/questions/20612028
复制相似问题