
I want to create a relationship in my "Users" collection that'll point to it's own self. Tho I'm not building a social media app, but you can think of it as the friends list of a user in a social media network. So each user doc will need a relationship named "friends" to its own collection ("Users" in this case), cuz each "friend" is also a user. When I try doing it from the console, I can't find the "Users" collection under the "Related Collection" search box.
I don't know if I was clear enough... Let me know if you want more details

Ya...you can't at the moment. You can either create a friendship collection and then have relationship attributes to the user collection.

wouldn't it make it harder to manage? and what will the friendship collection contain?

I don't think so. I also usually avoid arrays because Appwrite doesn't support array operations

what the friendship collection should contain?

A two way many to one. This would allow you to see all the friends a user has from the user collection. Then, a one way many to one. Actually...this works more for a follower following scenario 🤔

do you mean, that whoever is added as a friend to anyone, should be added to the "friends" collection with a two-way many-to-one relationship with "Users"?

Yes, but there should be two attributes.
Maybe two documents should be added for each triend

about attributes, we need to store all the necessary info of the friend along with the relationship attribute. is there any more important attribute in your mind?

Maybe two documents should be added for each triend why two documents?

So that you can make 1 query to get all the friends of a user

if we do two-way many-to-many, then can't we just get all the friends of a user directly from the user doc? only need to get the corresponding user document and read the "friends" attribute?

sure i guess.

[SOLVED] How to create relationship within the same collection?
Recommended threads
- A feature/Fix request
Whenever I use Appwrite then to see the items of document I've to click "columns" option and select those items that I want to see then if I refresh browser/pa...
- Collections not showing for relationship...
I am updating one of my databases. I have removed the majority of collection and started adding new collections. The new collections do not appear in the drop d...
- Error: The document data is missing. Try...
I am not able to create any document on some of the collection/ DBs. As I can see many of us facing the same issue, need a quick resolution from the Appwrite Te...
