TypedAggregation参数1: 需要操作的类
TypedAggregation参数2: 查询条件Criteria
TypedAggregation参数3: 采样数
//构造统计函数
TypedAggregation<RecommendUser> aggregation = new TypedAggregation<>(RecommendUser.class,
Aggregation.match(criteria), Aggregation.sample(10));
//查询
AggregationResults<RecommendUser> aggregate = mongoTemplate.aggregate(aggregation, RecommendUser.class);
//返回
return aggregate.getMappedResults();