数据库用的是mongodb,在做数据统计,除了用代码去实现数据的分类,累计,mongo的一些语句也可以实现,看起也更简洁
统计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)
第一个{} 是筛选条件
m
a
t
c
h
,
查
找
2019
−
09
−
27
之
后
的
n
o
r
m
字
段
值
为
是
或
否
的
所
有
数
据
第
二
个
分
组
match, 查找2019-09-27之后的norm字段值为是或否的所有数据 第二个{} 分组
match,查找2019−09−27之后的norm字段值为是或否的所有数据第二个分组group,_id为固定的,值为分组key(带上$), total 可以自定义命名, $sum 是统计