Группировка элементов по дате дочернего массива
Возможно ли сгруппировать по дате (createDate) в дочернем массиве? Нужно что бы была основная запись (она будет дублироваться много раз, если дата будет разная) и дочерние элементы с одной датой. Хочу вывести красиво на страницу по датам создания, что бы была основная запись и при раскрытии блока выводились записи из computerEvents. Ключом в бд является createDate и id Мне прилетают данные с сервера в виде:
{
"maC_Address": "F4:B5:20:35:40:8E",
"iP_Address": "100.105.15.19",
"name_PC": "GH-440",
"bridge": "BridgeSTD",
"status": 0,
"components": [],
"computerEvents": [
{
"id": "bf49932c-522f-40e1-b3aa-958245e57b81",
"computerId": "F4:B5:20:35:40:8E",
"createDate": "2023-03-15T05:28:29.004484Z",
"description": "ChannelA-DIMM0 RAM: 8192 Mbyte",
"event": 0,
"type": 4
},
{
"id": "3f11ac8b-5e14-4687-9bc8-89b3e7e96079",
"computerId": "F4:B5:20:35:40:8E",
"createDate": "2023-03-15T05:28:29.004483Z",
"description": "Базовый видеоадаптер (Майкрософт)",
"event": 0,
"type": 0
},
{
"id": "e875dc2b-d5cd-4630-ad42-8187ea0712a3",
"computerId": "F4:B5:20:35:40:8E",
"createDate": "2023-03-15T05:28:29.004484Z",
"description": "U3E1 Intel(R) Core(TM) i3-9100 CPU @ 3.60GHz",
"event": 0,
"type": 3
},
{
"id": "28c7fcba-3b78-4933-8315-3ba4fb94ab6e",
"computerId": "F4:B5:20:35:40:8E",
"createDate": "2023-03-15T05:28:29.004484Z",
"description": "BIOS Date: 11/27/20 14:20:28 Ver: 05.0000C",
"event": 0,
"type": 1
},
{
"id": "5bc5930d-a988-4d0e-bccb-22d2e43db01d",
"computerId": "F4:B5:20:35:40:8E",
"createDate": "2023-03-15T05:28:29.004484Z",
"description": "H310MHP",
"event": 0,
"type": 2
}
]
},
{
"maC_Address": "F4:B5:20:35:40:D7",
"iP_Address": "100.105.22.2",
"name_PC": "GD-230",
"bridge": "BridgeSTD",
"status": 0,
"components": [],
"computerEvents": [
{
"id": "3c3c040f-0394-4aae-825d-9c90337be5ef",
"computerId": "F4:B5:20:35:40:D7",
"createDate": "2023-03-20T03:21:52.689966Z",
"description": "U3E1 Intel(R) Core(TM) i3-9100 CPU @ 3.60GHz",
"event": 0,
"type": 3
},
{
"id": "ccfb3619-9b08-49f0-a191-5454feac496c",
"computerId": "F4:B5:20:35:40:D7",
"createDate": "2023-03-20T03:21:52.689547Z",
"description": "NVIDIA GeForce GTX 1050 Ti",
"event": 0,
"type": 0
},
{
"id": "dbe3eb8f-5c18-4585-b8f6-4c26218deafa",
"computerId": "F4:B5:20:35:40:D7",
"createDate": "2023-03-20T03:21:52.689965Z",
"description": "5.12",
"event": 0,
"type": 1
},
{
"id": "313801d2-98f9-4939-b784-741ad06d5e95",
"computerId": "F4:B5:20:35:40:D7",
"createDate": "2023-03-20T03:21:52.689966Z",
"description": "H310MHP",
"event": 0,
"type": 2
},
{
"id": "0bd01695-c620-41eb-84cc-4373bccf53cc",
"computerId": "F4:B5:20:35:40:D7",
"createDate": "2023-03-20T03:21:52.689967Z",
"description": "ChannelA-DIMM0 RAM: 8192 Mbyte",
"event": 0,
"type": 4
}
]
}
Источник: Stack Overflow на русском