I'm new to LoopBack
, and I seem to be missing something.
I've heard so much about StrongLoop
and LoopBack
, I find it hard to believe this doesn't exist.
My case: I'm looking to count the amount of events with each different severity.
A table for example:
EventID | Severity
1 | 2
2 | 2
3 | 4
4 | 3
5 | 3
6 | 5
7 | 1
8 | 2
Now I want to count the amount of events and group them by severity, so I get something like this JSON back:
{1:1, 2:3, 3:2, 4:1, 5:1} *(severity:count)*
With SQL it's quite simple, just use "SELECT severity, count(severity) FROM events GROUP BY severity"
.
I have researched this for a while, and still can't believe this simple thing can't be done with LoopBack
!
Any solution? Or maybe an article to point me to?
Thanks in advance!