Spring Data MongoDB Aggregation获得计数大于0的数据

时间:2019-05-31 14:20:39

标签: mongodb aggregation-framework spring-data-mongodb

如何对结果计数大于0的过滤器进行投影

import static org.springframework.data.mongodb.core.aggregation.Aggregation.*;

Aggregation agg = newAggregation(    
    unwind("feedTag"),
    group("feedTag.tagValue").count().as("number"),    
    sort(ASC, "_id") 
);

// Convert the aggregation result into a List
AggregationResults<Feed> results = mongoTemplate.aggregate(agg, "feed", Feed.class);
List<Feed> feedCount = results.getMappedResults();

如何获取计数大于零的结果

0 个答案:

没有答案