Count based on Grouping

I have 2 tables - Items and Users

Each item will be mapped to an user and I wish to get all users and the number of items mapped to them in the table.

What are the backendless way of doing this in JavaScript? I don’t want to loop the entire database and have a counter for calculating as it might slow down when table size increases.

We do not have support for aggregating functions (SUM, AVERAGE, etc) at the moment.

Thanks for update.