Answer the question
In order to leave comments, you need to log in
How to return grouped data by date node + mongoose?
Hello!
There is a User model, it stores data:
{
name: 'user',
history: [
{ date: 01, val: 2},
{ date: 01, val: 3},
{ date: 02, val: 2}
]
}
Задача заключается в выдаче res.json в формате:
{
history: [
{
title: 01,
data: [
{ date: 01, val: 2},
{ date: 01, val: 3}
]
},
{
title: 02,
data: [
{ date: 02, val: 2},
]
},
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question