Skip to content
Back

Incremental/Updates based on OG value while updating ALL documents.

  • 0
  • Databases
  • REST API
Sober
25 Jul, 2025, 23:03

I've set up my own SDK accessed as below

TypeScript
DB["userinfo"]["bankaccounts"]:update({
        method = "equal",
        attribute = "userid",
        values = { 1 }
    }, function(res)
        print(res)
        for i,v in pairs(res) do
            print(v.balance)
            v.balance = v.balance + 1
        end
        return res
    end)```

I'm concerned with how on the backend I'll update the appended changes
I see I have two options after determining which values have been changed.
1. `PATCH /databases/{databaseId}/collections/{collectionId}/documents/{documentId}`
Update each document individually which I'm worried if scaled will affect the rate limit (not only by appwrite but outgoing http limitations)

2. `PATCH /databases/{databaseId}/collections/{collectionId}/documents`
Second case seems more preferable as its all done in one request, however from my knowledge there isn't any way I can accomplish as done in the example, comparing previous data.

Is there a way that I can make method 2 work or do I have to work with method 1?
TL;DR
Developers want to update multiple documents at once based on OG value. They are considering individual updates or bulk updates using API requests. Solution: Stick with method 1 to avoid rate limits while updating each document individually.
Sober
25 Jul, 2025, 23:07

Incase the context helps, the update functions at the moment lists documents with the provided query, and runs the callback functions with those results (variable res)

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more