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
- Why does this happen?
`AppwriteException: general_argument_invalid, Invalid `secret` param: Value must be a valid string and at least 1 chars and no longer than 256 chars (400)` the...
- Database Write Limits hit
Hello Appwrite Admins, I'm a GitHub Education user, and about a week ago, my database was really badly optimized, resulting in about 600k writes in a single day...
- How to properly implement custom domain?...