I want to find information that is on the same date.My Data is
[
{
"reservations": [],
"_id": "5ff62f01d274650f5f187c00",
"floorNumber": "floor 4",
"sessionInDay": "morning",
"start": "2021-01-10T00:00:00.000Z",
"seatsAvailable": 15,
"id": 1,
"__v": 0
},
{
"reservations": [],
"_id": "5ff6346be9a69310deeeabc2",
"floorNumber": "floor 4",
"sessionInDay": "morning",
"start": "2021-01-05T00:00:00.000Z",
"seatsAvailable": 15,
"id": 2,
"__v": 0
},
{
"reservations": [],
"_id": "5ff6346be9a69310deeeabc2",
"floorNumber": "floor 4",
"sessionInDay": "afternoon",
"start": "2021-01-05T00:00:00.000Z",
"seatsAvailable": 15,
"id": 3,
"__v": 0
}
]
I want to combine data with the same start date. To come out in what format? How do I query? The data format I want to output :
[
{
"start": "2021-01-10T00:00:00.000Z",
"details": [
{
"reservations": [],
"_id": "5ff62f01d274650f5f187c00",
"floorNumber": "floor 4",
"sessionInDay": "morning",
"start": "2021-01-10T00:00:00.000Z",
"seatsAvailable": 15,
"id": 1
}
]
},
{
"start": "2021-01-05T00:00:00.000Z",
"details": [
{
"reservations": [],
"_id": "5ff6346be9a69310fad23413",
"floorNumber": "floor 4",
"sessionInDay": "morning",
"start": "2021-01-05T00:00:00.000Z",
"seatsAvailable": 15,
"id": 2
},
{
"reservations": [],
"_id": "5ff6346be9a69310deeeabc2",
"floorNumber": "floor 4",
"sessionInDay": "afternoon",
"start": "2021-01-05T00:00:00.000Z",
"seatsAvailable": 15,
"id": 3
}
]
}
]
The last question, this step. Should I format data like this, save it to the Database, or should I use the Query method?
Thank to help me.