Back

[SOLVED] ID.unique() doesn't work

  • 0
  • Web
D5
23 Dec, 2023, 13:22

The name, creator, logo, etc part doesn't looks correct

TL;DR
The issue with `ID.unique()` not working has been solved. The problem was that the Songs collection had a one-to-one relationship with the User collection, which caused the error. The error message was correct but could have been more detailed. To close the thread, the user should provide the relevant variable where the issue is occurring. The code snippet provided in the log looks incorrect, so it may be a browser interpretation issue. The correct structure for the song should be in JSON format, with key-value pairs. The issue seems to be with specific collections and their structure. The variable mentioned in the log appears to be correct, but the name
D5
23 Dec, 2023, 13:23

Nevermind, the variable is correct

D5
23 Dec, 2023, 13:24

Oh, wait, what's it. Could you please send it?

D5
23 Dec, 2023, 13:24

Or an example?

Diversified
23 Dec, 2023, 13:25

.

D5
23 Dec, 2023, 13:25

name contains just name?

D5
23 Dec, 2023, 13:26

It should be like a JSON. Something like this:

TypeScript
{
"name": "D5"
}
Diversified
23 Dec, 2023, 13:28

name is a string and is getting parsed correctly, my issue lies with a specific collection which throws error mentioned before

Diversified
23 Dec, 2023, 13:29

Something I tried is I created a new user and this allowed me to upload/save a document(sound) but the secodn time its throws an error

Diversified
23 Dec, 2023, 13:29

is the ID caching in the backend or someting

D5
23 Dec, 2023, 13:30

In the log doesn't looks correct

D5
23 Dec, 2023, 13:30

Looks like this:

TypeScript
{
name: "D5"
}
D5
23 Dec, 2023, 13:31

Not sure if it's due to browser interpretation or similar 😅

D5
23 Dec, 2023, 13:31

Are you using Appwrite cloud or self-hosting?

Diversified
23 Dec, 2023, 13:31

should be that cause in DB it is correct

Diversified
23 Dec, 2023, 13:31

cloud

D5
23 Dec, 2023, 13:32

It's not in DB but in your variable

D5
23 Dec, 2023, 13:32

What's the part of the code where you set the variable?

Diversified
23 Dec, 2023, 13:39

what variable?

Diversified
23 Dec, 2023, 13:54

This issue got my head scratching, but finally I realised what was wrong, the error message was right but it should've been more verbose My Sounds collection has one to one relation with user, this caused the error to occur, idk how this didn't happen before when I was testing . Anyways thanks. Hwo can I close this thread

D5
23 Dec, 2023, 14:11

I'm closing it. Makes sense, didn't have thought about the relationship 😅

D5
23 Dec, 2023, 14:12
D5
23 Dec, 2023, 14:12

[SOLVED] ID.unique() doesn't work

Christy Jacob
23 Dec, 2023, 18:44

Thanks for the feedback. I will relay this to the team. We can try and have a better error message in this case 👍

Do you mind sharing the structures of the collections in question? The songs and users collection and how they are related?

Thanks

Christy Jacob
23 Dec, 2023, 18:48

@Diversified

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more