Back

How to relate documents to users, and collections to themselves?

  • 0
  • Databases
  • Auth
  • General
deusMarte
26 Nov, 2024, 19:49

The prelude in Appwrite's Relationships Documentation states:

*Entities in real-life often associate with each other in an organic and logical way, like a person and their dog, an album and its songs, or friends in a social network.

These types of association between entities can be modeled in Appwrite using relationships.*

However, when I create a relationship attribute in a collection, I see no option to relate the collection to Users. So, I don't see how I can create, for example, a Tasks collection with a many to one relationship with Users.

Moreover, it also doesn't seem to be possible to relate a collection to itself. So, for example, if I wanted to use relationship attributes to model a parent task and subtasks structure in my Tasks collection, I can't because Appwrite doesn't show me the current collection as an option in the dropdown of available collections when I create a relationship attribute.

Also, to support users having friends or similar functionality, it should be possible to also relate Users to Users, but it seems the Users list/collection one gets as people sign up to their app isn't treated as a regular collection at all, so I can't add custom attributes to Users nor relate them to anything.

Am I missing something, or is it really not possible to relate collections to Users and collections to themselves? Because if those two aren't supported yet, then much of what the prelude in the Relationship docs tease with isn't even possible to do with Appwrite's Relationships yet.

Thank you for reading, I appreciate any pointers! :appwriteheart:

TL;DR
- Developers want to relate documents in collections to Users and to themselves using Appwrite's Relationships feature. - Appwrite currently does not provide the option to relate collections to Users or to themselves. - This limitation hinders developers from creating structures like Tasks with a many-to-one relationship with Users or modeling parent tasks and subtasks in a Tasks collection. - Developers also cannot add custom attributes to Users or relate Users to other Users. - The teased functionalities in the documentation are not fully supported by Appwrite's Relationships feature at the moment.
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