如下資料格式,我想對 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
}
雷雷