Hey,
I have the following structure of document within mongoDb:
{
"description" : "description_test",
"expressionGroups" : [
{
"type" : "TYPE_1",
"expressions" : [
{
"name" : "NAME_1",
"values" : ["VAL_1", "VAL_2"]
},
{
"name" : "NAME_2",
"values" : ["VAL_3"]
}
]
},
{
"type" : "TYPE_2",
"expressions" : [
{
"name" : "NAME_3",
"values" : ["VAL_4", "VAL_5"]
},
{
"name" : "NAME_4",
"values" : ["VAL_6"]
}
]
}
]
}
I implemented org.springframework.data.querydsl.QueryDslPredicateExecutor because I want to use this method:
Iterable<T> findAll(Predicate predicate);
I generated Q-classes using apt-maven-plugin, unfortunately I don't know how to create a complex predicate.
I've prepared appropriate query but using mongo shell syntax.
db.rule.find({
'expressionGroups.expressions': {
$all: [
{
'$elemMatch': {
'name': "NAME_3",
'values': "VAL_5"
}
},
{
'$elemMatch': {
'name': "NAME_2",
'values': "VAL_3"
}
}
]
}
}).pretty()
Do you know how to create equivalent predicate based on above query?