is it possible to prevent creating a document that has a property (example: username) identical to another document?
You can use a unique index for that: https://appwrite.io/docs/databases#indexes
so I have to check if the username is available before creating an account right (and create a document) ?
You mean ID? Or email? The API would return an error if one already exists
No username. I mean my user
collection look like that (with some example) :
When I create a new user, I add a document with the usernameand extra info like language, bio, avatar etc...
But I dont want to have the same username in two different document
How about use the same custom id when creating the user and for the document id of this users collection?
So I thought it was easier to retrieve a document by its id rather than looking for the document that has a certain userId. I thought it was faster in terms of performance and server load, isn't it?
Yes, It's faster to do getDocument rather than listDocumebts
[SOLVED] Prevent creating a document that has a property identical to another
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...