</pre><p>在SQL语句中如要做统计一般是这种方式</p><p></p><pre name="code" class="sql">SELECT ..,SUM(1)
FROM ..
WHERE ..
GROUP BY ..
HAVING ..
SORT ..
在MONGODB中的架构图:
在SPRING DATA MONGODB中是这样写的:
public class VideoRepositoryImpl implements VideoRepositoryCustom{
private static Logger logger = LoggerFactory.getLogger(VideoRepositoryImpl.class);
@Autowired
private MongoTemplate mongoTemplate;
public List<Cat1UpdateCount> getVideoWithUpdateFrag(List<String> importantCat1List) {
logger.info(new Date().toString());
/**
* db.videos.aggregate

本文介绍了如何在Spring Data MongoDB中利用聚合操作进行统计查询。通过具体的案例,展示了在实际项目中如何编写和执行聚合查询,帮助读者掌握这一功能。
2109

被折叠的 条评论
为什么被折叠?



