I have an app where users can bookmark webpages. When a user bookmarks a page I'd like to save that page in the database, then get the ID of that document and add it to their profile. That's not an issue. What I want to do is if a second user bookmarks the same page I want to check the bookmarks table to see it it already exists. If it does I want to use the existing ID for user 2 and if it doesn't already exist I want to create it and then update the user's profile with the newly created ID. I believe supabase has something like createIfNotExists. Is there something similar in appwrite? I'm using nextjs
In Appwrite you can:
- Try to create it and in case you'll get error then fetch the ID.
- Try to first fetch it by URL if no results then create it
- Move 1 and 2 to a cloud function
That said, it seems like a great feature to have, like Supbase doest. I didn't find one regarding that issue, you can create one here https://github.com/appwrite/appwrite/issues
@illmagination does this seem okay for you?
Recommended threads
- Session not found. Please run appwrite l...
I have encounter an issue with appwrite CLI They asking for a login session but in the doc, it’s mention that only setup client with endpoint / api key is enou...
- SELF HOSTING ISSUE, DATA NOT MIGRATING T...
Hey, devs, I recently tried to migrate my cloud instance to a self hosted version but my data is not transferred fully only the table structure is transferred ...
- No Document ID?
Hi I have a self hosted appwrite. My documents get a document ID but are not visible in the console. I don't know why this happens and how to fix this