数据库用的是mongodb,在做数据统计,除了用代码去实现数据的分类,累计,mongo的一些语句也可以实现,看起也更简洁

mongodb 分组统计
统计norm字段值为是与否的数据量
语句:
[{KaTeX parse error: Expected '}', got 'EOF' at end of input: …tch: {"norm": {in: [“是”, “否”]},
“date”: {KaTeX parse error: Expected 'EOF', got '}' at position 40: …11:38:56.402Z")}̲}}, {group : {_id : "KaTeX parse error: Expected '}', got 'EOF' at end of input: …orm", total : {sum : 1}}}]

一个列表中包含两个{}(python中字典,Java中map)
第一个{} 是筛选条件 match,20190927normmatch, 查找2019-09-27之后的norm字段值为是或否的所有数据 第二个{} 分组group,_id为固定的,值为分组key(带上$), total 可以自定义命名, $sum 是统计

相关文章: