GregMc
Posts: 0
Joined: Wed Dec 03, 2014 12:46 am

SUM query using DB service

I have a need to query a collection on a set of criteria and for all rows that match the criteria SUM the values in one column. I have read in the mongoDB doc that this is possible using the aggregation framework functions described here: http://docs.mongodb.org/manual/refere...

Is it possible to perform this sort of query in an appery database service?

GregMc
Posts: 0
Joined: Wed Dec 03, 2014 12:46 am

SUM query using DB service

Just to clarify I would like to know if this is possible via an appery DB service, and if it is not possible through a DB service can a generic service be created to use the aggregate functions?

Ihor Didevych
Posts: 0
Joined: Wed Nov 19, 2014 7:55 pm

SUM query using DB service

Hi Greg,

Unfortunately, we don't have this API.

GregMc
Posts: 0
Joined: Wed Dec 03, 2014 12:46 am

SUM query using DB service

Hi Ihor,

So there is no way at all to access this framework from within appery? I saw this post as well asking for this functionality quite some time back: https://getsatisfaction.com/apperyio/...

Being able to do data aggregation of collections (Sums & Averages) is required for my app. I have a collection of student quiz answers and need to be able to aggregate these by a student ID and quiz ID in to the sum of points per student on a quiz and the average points per answer per student on a quiz.

Its disturbing to find things like this not implemented since the whole purpose of using a platform like appery is to leverage the framework for common functions and not have to re-write things like database aggregation methods that should just be there and ready to use.

Thanks.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

SUM query using DB service

Hello Greg,

[quote:]So there is no way at all to access this framework from within appery?[/quote].
You can implement a small code snippets which can do all Sum and Average.

aggregate
Posts: 0
Joined: Thu Apr 24, 2014 11:37 am

SUM query using DB service

Hi Eugene.. Can you provide a sample of how we can use code to do sums and other agggregate functions via code

John de Quarius
Posts: 0
Joined: Fri Dec 11, 2015 7:16 pm

SUM query using DB service

Greg

Have you look at the Server Code scripting? You can pass criteria there using some of the operations but I don't remember seeing Sum as one of the supported. However perhaps instead of doing the calculation on the client side, do it on the server side and return the response so that workload is not done on the client and this way you can call multiple collections with one client call to the service.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

SUM query using DB service

Hello Aggregate,

Unfortunately we don't have ready code for this case. You may search for it online.

Return to “Issues”