如下数据格式,我想对 fill_time
进行 group by,fill_time
字段嵌套在第三层。
业务要求:如果这一条记录有多个不同的fill_time
,则需分组统计多次。例如下面的数据,则统计两次,分别3月15日
和3月17日
各算一个,请问能不能用 aggregate
实现?
{
"_id": "56e932f42ec56a4afc00a083",
"binding_time": "2016-03-16 18:18:28",
"categorys": [
{
"category_code": "003",
"category_name": "颈椎疾患",
"datas": [
{
"fill_time": "2016-03-17 10:47:59",
"form_code": "6",
"plan_code": "P45",
"results": []
},
{
"fill_time": "2016-03-17 10:48:25",
"form_code": "3",
"plan_code": "P45",
"results": []
}
],
"edc_patId": "P015830",
"start_time": "2014-4-21 13:41:42"
},
{
"category_code": "004",
"category_name": "脊柱肿瘤",
"datas": [
{
"fill_time": "2016-03-15 10:48:48",
"form_code": "34",
"plan_code": "P47",
"results": []
},
{
"fill_time": "2016-03-15 10:49:14",
"form_code": "36",
"plan_code": "P47",
"results": []
}
],
"edc_patId": "P038894",
"start_time": "2014-4-21 13:41:42"
}
],
"patient_id": "000997785203",
"person_name": "张三",
"project_code": "SYGK",
"subscribe": false
}
リーリー