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
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...