Spring mongo 聚合函数




TypedAggregation<DemoEntity> aggregation = newAggregation(DemoEntity.class, match(match), group("name").count().as("total"), sort(Sort.Direction.ASC, "total"), skip(0), limit(3)); AggregationResults<DBObject> result = mongo.aggregate(aggregation, DBObject.class); DBObject obj = result.getRawResults();

 

posted @ 2015-11-05 15:30  wind90  阅读(345)  评论(0编辑  收藏  举报