#Calculating sum of numbers in an Attribute of collection, limit of 25

8 messages · Page 1 of 1 (latest)

magic surge
#

By default appwrite limits query to 25 items for better performance, what's the way to calculate sum of numbers in each document. I have a finance demo app with 500 entries, need to sum all numbers but default appwrite query get 25 items, I can put 1000 limit in Query.limit but won't that affect performance?

Is there a way to solve this?

somber folio
#

I don't know if this is the best way of solving it but to do something similar I created a function with a trigger on documents that kept a running total in a different collection

#

Until aggregation functions are added I can't think of another way of doing it

tepid kraken
somber folio
# tepid kraken how you go about an updated document

The Databases service allows you to create structured collections of documents, query and filter lists of documents, and manage an advanced set of read and write access permissions.

All data returned by the Databases service are represented as structured JSON documents.

The Databases service can contain multiple databases, each database can co...

tepid kraken
#

With your method of storing the total in another collection. i guess the function is triggered on document.create

#

what if the user updates the value in a document. lets say you user creates a document with value 1000 and then updates it to 1200

somber folio
#

then you watch for update?