Je kunt onderstaande zoekopdracht proberen.
Statische invoer
import static org.springframework.data.mongodb.core.aggregation.Aggregation.*;
import static org.springframework.data.mongodb.core.aggregation.ArrayOperators.Filter.filter;
import static org.springframework.data.mongodb.core.aggregation.ComparisonOperators.Eq.valueOf;
Code
Aggregation aggregation = newAggregation(
project().and(filter("parts")
.as("item")
.by(valueOf(
"item.currentState")
.equalToValue(
"Estimation Confirmed")))
.as("parts");
);
List<outputType> results = mongoTemplate.aggregate(aggregation, inputType, outputType)