I can't find a way to do this with LoopBack, I though someone could maybe help, or point me to an alternative/recommended way to do this.
I have a 'Traffic' model that looks like this:
{
"fromTime": "string",
"toTime": "string",
"trafficTypeId": 0,
"totalPackets": 0,
"totalSize": "string",
"id": 0
}
Now, each model is made with certain interval, say from 16:00 to 16:05, and it keeps the total packets and size that was processed in this time.
I have a need to display a graph, that changes it's display from hourly/daily/weekly etc.
How would I make it so the summing won't happen in the client side, as I am afraid performance issues may arise (when trying to sum a month using 5 minute intervals)? Instead I would like to make a function that takes 2 arguments: startTime and endTime, and returns 1 object with the sum of packets and total size for this time?
I've looked at remote methods, but it doesn't seem to fit my needs. Am I wrong in understanding this?
Is there any other recommended way to try?
Edit: Is it possible to call something like this:
traffic.find({'where': {`fromTime': {gt: SOME_TIME}, 'toTime': {lt: SOME_OTHER_TIME } }); // (using AngularJS)
and have the returned data passed to a remote method that I will code, to sum up the values I want?