How does js merge some items in an array of objects?

Source data:

data: [
{
    parkId: 1,
    scheduleId: 1,
    hasStock: false
},
{
    parkId: 1,
    scheduleId: 2,
    hasStock: false
},
{
    parkId: 1,
    scheduleId: 3,
    hasStock: false
},
{
    parkId: 2,
    scheduleId: 1,
    hasStock: false
},
{
    parkId: 2,
    scheduleId: 2,
    hasStock: false
},
{
    parkId: 2,
    scheduleId: 3,
    hasStock: false
}
]

expect items with the same parkId to be merged into the following format:

[
    {
        parkId: 1,
        date: [
            {
                scheduleId: 1,
                hasStock: false
            },
            {
                scheduleId: 2,
                hasStock: false
            },
            {
                scheduleId: 3,
                hasStock: false
            }
        ]
    },
    {
        parkId: 2,
        date: [
            {
                scheduleId: 1,
                hasStock: false
            },
            {
                scheduleId: 2,
                hasStock: false
            },
            {
                scheduleId: 3,
                hasStock: false
            }
        ]
    }
]

do you bosses have any more elegant ways


let uniqueObj = {};
let result = data.map( item => {
    return {
        parkId: item.parkId,
        data: data.filter( childItem => childItem.parkId === item.parkId)
    }
}).reduce( (array, item) => {
    if(!uniqueObj[`parkId${item.parkId}`]) {
        array.push(item);
        uniqueObj[`parkId${item.parkId}`] = true;
    }
    return array;
}, []);
uniqueObj = null; //
console.log(result);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30cac-2bd49.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30cac-2bd49.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?