How do I query a relationship attribute? #7369
-
|
For example I have to collections 'Users' and 'Posts' with a two way many-to-many relationship of 'likes' and 'likedBy' respectively. How do I query the likes of a User? I have tried listDocuments with Query.select(['likes']) but I am getting error. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 14 comments 10 replies
-
|
Queries on relationships are not supported. That said, we do plan on adding support. Source: https://appwrite.io/docs/products/databases/relationships#queries |
Beta Was this translation helpful? Give feedback.
-
|
when is it going to be launched, this is such an essential query that should have been launched when relationships were introduced. |
Beta Was this translation helpful? Give feedback.
-
|
Looking forward to its implementation! Will it be mentioned in the road map? |
Beta Was this translation helpful? Give feedback.
-
|
any updates? |
Beta Was this translation helpful? Give feedback.
-
|
Is there any update |
Beta Was this translation helpful? Give feedback.
-
|
This is important for me too. |
Beta Was this translation helpful? Give feedback.
-
|
WTF! This is ridiculous, guys! |
Beta Was this translation helpful? Give feedback.
-
|
Is this still not supported? We’re using Appwrite in a pretty complex application and decided to add search. It works when querying a one-to-many relationship, but we get an error when querying a many-to-many relationship. I see threads from over two years ago discussing this feature being added soon. If it still hasn’t landed, I’m seriously considering creating an abstract service layer and migrating all our applications from Appwrite to Supabase or Convex. It’s a shame because I really liked Appwrite. (cc @stnguyen90) |
Beta Was this translation helpful? Give feedback.
-
|
This is important to us. Come on, maintainer |
Beta Was this translation helpful? Give feedback.
-
|
This is a critical missing feature. Without proper relationship queries, the database is effectively unusable for any more complex application. If Appwrite database was truly NoSQL rather than a NoSQL-style API on top of MariaDB, this limitation might be understandable. But given the fact that Appwrite uses MariaDB, then the lack of relationship queries is a serious bummer. Features like messaging, Appwrite sites, or updating counters are useful, but they are not fundamental functionalities in my opinion. Relationship queries are essential for any meaningful application, and notably, they did work (at least partially) in Appwrite version 1.5.5. For example, this query used to work: const res = await databases.listDocuments(database, "messages", [
Query.equal("room", roomId),
Query.orderDesc("$updatedAt"),
Query.limit(50),
]);I believe this feature should be prioritized over the others, and it seems I’m not the only one who thinks so. |
Beta Was this translation helpful? Give feedback.
-
|
In a world where even an enduser tool like Notion has proper databases and relations with queries, it's unacceptable for appwrite to still not support this. I'm seriously thinking of switching to directus. |
Beta Was this translation helpful? Give feedback.
-
|
Plus, they’re pretty much ignoring this request. I’ve tried asking for a timeline in Discord, but I didn’t even get a response. We’re switching to Supabase now. Honestly, I was so excited to build with Appwrite when we first started our project, but a year later it’s been a complete shit show. The platform lacks data integrity, and I’m not sure how they decided to remove the Beta label when core functionality is still missing and there are so many critical issues. We’ve suffered multiple data losses through database restores and using the CLI. |
Beta Was this translation helpful? Give feedback.
-
|
I considered Appwrite, Directus and Supabase for a project about a year ago. I did POCs with all of them. Got quite far with Directus, but then rejected it based on their commercial model. Rejected Appwrite because of no support for Postgres and the problems with relationships. Settled on Supabase and I've been pretty happy. |
Beta Was this translation helpful? Give feedback.
-
|
Any updates on this? |
Beta Was this translation helpful? Give feedback.
Queries on relationships are not supported. That said, we do plan on adding support.
Source: https://appwrite.io/docs/products/databases/relationships#queries