
count and sum values
Hi,
I have an endpoint showing the total count(<records>) and sum(<some price>) values of the records in 2 models, filtering on the current year and the previous year. Ultimately, I would like to show these count and sum per week, per month or per year.
The way I do this now, is to create two filtered collections for the records in the current year and previous year and then create SUM() and COUNT() variables from the collections.
Now the model is growing in records (currently a couple of thousands of records) the log is mentioning that this might degrade performance.
The model will grow over time to several hundreds of thousands of records, so I need another approach on this.
Any suggestions? They are highly appreciated :-)
Hans
Hi,
I have an endpoint showing the total count(<records>) and sum(<some price>) values of the records in 2 models, filtering on the current year and the previous year. Ultimately, I would like to show these count and sum per week, per month or per year.
The way I do this now, is to create two filtered collections for the records in the current year and previous year and then create SUM() and COUNT() variables from the collections.
Now the model is growing in records (currently a couple of thousands of records) the log is mentioning that this might degrade performance.
The model will grow over time to several hundreds of thousands of records, so I need another approach on this.
Any suggestions? They are highly appreciated :-)
Hans
Login to reply