Displaying data for each day of the week with rethinkDB r.row('time_create').dayOfWeek()
[
{
detail: "no",
order_id: "03",
status: "Delivery",
time_create: "2018-09-23T11:06:30.164Z",
time_success: "2018-09-23T11:06:30.164Z"
}
]
To be like this
{
"date":
{
"Sun": [
{
"order_id": "00004568",
"status": "Delivery",
"time_create": "09/16/2018 10:09:39",
"time_success": "09/19/2018 10:39:40",
"detail": ""
}
],
"Mon": [
{
"order_id": "00004568",
"status": "Delivery",
"time_create": "09/17/2018 10:09:39",
"time_success": "09/19/2018 10:39:40",
"detail": ""
},
]
}
}
I do not understand how to fix it or write it out as it is
You can use group with key names, indexes, ReQL or custom functions. In your case this should do:
Then, in your callback, you can easily transform this result into the structure you want.