Можете да опитате заявката по-долу.
Статичен импорт
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;
Код
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)