[SOLVED] Prevent creating a document that has a property identical to another
- 0
- Resolved
- Databases
- Web
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 usercollection 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
- education plan not activated
Hi I have an edu id 13103046@iubat.edu but when I am trying to claim my plan and trying to logging with github where education student plan active. the appwrite...
- I'm getting an error on the console "j?....
On my self hosted instance version 1.8.1 the console is giving me this error when trying to view the rows for a table I recently created. My application is read...
- 500 simultaneous OAuth logins from the s...
Hi, I'd like to ask about rate limiting around Google OAuth login on Appwrite Cloud. **OVERVIEW** Service type: A PWA (web app) for members of a university clu...