I created a server using Node.JS and Express. Database - MongoDB, ORM - Mongoose. Here is what I need to do.
{
"_id": "5788fcf7bfecf0c135178418",
"incomeDate": "2012-01-01T00:00:00.000Z",
"name": "Sales",
"type": "Sales one",
"amount": 5500,
"__v": 0
}
This is the object that I get from the database. I want to filter these objects by date (actually by month). I am going to display monthly income on a chart using Angular Charts. ( https://jtblin.imtqy.com/angular-chart.js/ ) → Angular Histogram.
So, if there is no amount in a particular month, then the list will contain 0 (0). The list should be like this. There are 12 list items. This is just an example.
[200,1200,10,0,124,542,1254,500,0,1254,36,87]
How to do it in Node.js and mongoose? It is necessary to filter using incomedate and make the code in Node.js .....