{
"Field1": "ABC",
"Field2": [
{ "Field3": "ABC1","Field4": "REVIEWED","Field5":"True" },
{ "Field3": "ABC2","Field4": "APPROVED","Field5":"True" },
{ "Field3": "ABC3","Field4": "REJECTED","Field5":"True" },
{ "Field3": "ABC4","Field4": "APPROVED","Field5":"False" }
]
}
I want to fetch APPROVED,REVIEWED and True record ie.
{
"Field1": "ABC",
"Field2": [
{ "Field3": "ABC1","Field4": "REVIEWED","Field5":"True" },
{ "Field3": "ABC2","Field4": "APPROVED","Field5":"True" }
]
}
following mongo aggregation query returns proper result
{
"$project": {
"Field1": "$Field1",
"Field2": {
"$filter": {
"input": "$field2",
"as": "fld2",
"cond": {
"$and": [
{
"$in": [
"$$fld2.field4",
[
"APPROVED",
"REVIEWED"
]
]
},
{
"$eq": [
"$$fld2.field5",
"True"
]
}
]
}
}
}
}
}
how to achieve the above query in spring mongo data db? Spring ProjectOperation with ArrayOperators.Filter.filter not providing chaining operation to do and with another condition.
You can try using BasicDBObject like this