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
- Error | general_unknown
I have built a website using Appwrite Cloud as backend, and also using sites for deployment. My website is live but sometimes it shows Appwrite's Error general_...
- Invalid token passed in the request
Hello, I have an issue using updateMagicURLSession. I send the email using sendMagicLink, which works fine. When i click the link in the email i get the invali...
- Introducing new string column types made...
Adding new string types is hugely bennificial! Unfortunately it made the current column types not editable to change their types to the new longer field types.