
this is what I'm getting in console
{"id":"unique()","message":"Document with the requested ID already exists.", "success":false}
this is my code
try:
id = ID.unique()
result = databases.create_document('database_id', 'collection_id', id, data = data,)
return res.json({"success": True, "message": "Data added successfully"})
except Exception as e:
return res.json({"success": False, "message": str(e), 'id': id})```
I imported
`from appwrite.id import ID`

Do you have a unique index on the collection?

I just created

Its still giving the same error

I believe Steven meant do you have any other unique indexes? Currently any conflicts regarding indexes is treated the same as duplicate ID.

You should not need an unique index for id to resolve this issue.

Oh yeah I have 4 unique indexes, including the one that I just created stupidly

There might be a conflict with those other 3 indexes.

Oh? let me see

It workedโ

How does ID.unique() works? I couldn't find it in docs

For the SDK, it just returns "unique()" and the backend generates one for you.

incidentally, I was examining the code just this instant and here it is: https://github.com/utopia-php/database/blob/59e4684cf87e03c12dab9240158c1dfc6888e534/src/Database/Helpers/ID.php#L14

What was the problem?
Recommended threads
- Upgrade Issue
Am having issue upgrading my appwrite account to pro as my card number is 19 and the required input is 16 digit
- createEmailPasswordSession Error using S...
Did someone succeed using SSR approach for login?
- [Solved] how to get user prefs from serv...
i want to get a specific users preferences from serverside maybe i missunderstood something
