Is there a way to automatically create a document if it doesn't exist, or update it if it does?
- 0
- Databases
- GraphQL
- General
- Web

Currently, I need to make two separate API calls: one to check if the document exists in the collection, and another to either create it if it doesn't exist or update it if it does. Is it possible to streamline this process so that a single API call can handle both scenarios: creating the document if it doesn't exist or updating it if it does?"

You're asking for an upsert API/method. We don't have that at the moment.
You could try creating an Appwrite function that wraps the logic

Duplicate question here as well: https://discord.com/channels/564160730845151244/1138110897013915709 in case it’s helpful

Might be something to explore. We had this question already multiple times iirc

Thanks for the confirmation. I will find the workaround. but reallly a needed inbuilt feaure. hope to see it in later release of appwrite.

feel free to create a feature request issue on github
Recommended threads
- I am facing this error: type 'Null' is ...
When attempting to fetch areas from the area collection, the application throws an error: "type 'Null' is not a subtype of type 'int.'" This issue originates in...
- Adding custom domain to Appwrite project
My app is hosted on Vercel on domain todo.velleb.com. On PC, the OAuth logins like GitHub, Discord and Google work and create the account and log in. On mobile ...
- #support
<#1072905050399191082> any help on that?
