In spring data mongodb using mongotemplate or mongorepository, how to achieve pagination for aggregateion
You can use MongoTemplate
org.spring.framework.data.mongodb.core.aggregation.Aggregation#skip
and
org.springframework.data.mongodb.core.aggregation.Aggregation#limit
Aggregation agg = newAggregation(
project("tags"),
skip(10),
limit(10)
);
AggregationResults results = mongoTemplate.aggregate(agg, "tags", TagCount.class);
List tagCount = results.getMappedResults();