
Hi all! Can I use ID.unique() for attributes? it returns a string “unique()”, not a unique code Thank you!

Can you provide some more details?
- What SDK are you using?
- What's your Appwrite version? Is it on cloud or sel-hosted?

Without any of this info, all I can say is that if you are creating a new document with databases.createDocument()
, you can use the ID.unique()
method that comes with the Appwrite SDK to generate a string of unique and random characters for the documentId

@safwan hi, thank you for answer.
- web sdk (client)
- 1.3 cloud (aws instance) example: const role_id = ID.unique(); try { let response = await database.createDocument(db_id, db_roles_id, 'unique()', {'role_id':role_id,'role_name':role_name}); …..

If i'm not wrong, you have to use ID.unique()
for the web sdk


The function ID.unqiue()
returns only the string
The generation of the unique id generation happens inside Appwrite in the server

You can look here for the actual code that generates the ID in Appwrite
https://github.com/utopia-php/database/blob/main/src/Database/Helpers/ID.php#L12

@Binyamin thank you for answer!

[SOLVED] ID.unique() use in attributes
Recommended threads
- setup custom domain to appwrite but stil...
i just installed a Appwrite instance in my vps and i did all default otions exept the domain i have setuop its dns as A records pointing to my vps ip altho...
- 1.7.x Style issue in the migration page
I am not able to select what to migrate because of the styling... the checkboxes are not showing on any of the appwrite versions 1.7.x. I tried other browsers, ...
- Appwrite Sites: Max File Size
Hello, I am facing an issue on my self-hosted appwrite instance with Appwrite Sites. I already have a small vite web app built out that I want to deploy, and ...
