Back

[CLOSED] Selecting single relationship attribute with Query.select returns all relationships

  • 0
  • Databases
obiwanzenobi
10 Sep, 2023, 23:11

1.4.2 I have collection with 3 relationships. I want to select only one of them but appwrite always returns all relationships.

select([\"$id\",\"$createdAt\",\"$updatedAt\",\"$permissions\",\"mediaThumbnail.$id\"]) returns (Sorry! dart map - should be understandable)

TypeScript
0 = {map entry} "$id" -> "64fe3b5ca83a1f7f0757"
1 = {map entry} "$createdAt" -> "2023-09-10T21:55:40.691+00:00"
2 = {map entry} "$updatedAt" -> "2023-09-10T22:34:16.739+00:00"
3 = {map entry} "$permissions" -> [_GrowableList]
4 = {map entry} "assignedToCategories" -> [_GrowableList]
5 = {map entry} "content" -> [_GrowableList]
6 = {map entry} "mediaThumbnail" -> [_Map]
7 = {map entry} "$databaseId" -> "main_database"
8 = {map entry} "$collectionId" -> "content_entry"

I selected mediaThumbnail relation, but content and assignedToCategories are returned as well

in comparison this select: select([\"$id\",\"$createdAt\",\"$updatedAt\",\"$permissions\"]) returns

TypeScript
0 = {map entry} "$id" -> "64fe3b5ca83a1f7f0757"
1 = {map entry} "$createdAt" -> "2023-09-10T21:55:40.691+00:00"
2 = {map entry} "$updatedAt" -> "2023-09-10T22:34:16.739+00:00"
3 = {map entry} "$permissions" -> [_GrowableList]
4 = {map entry} "$databaseId" -> "main_database"
5 = {map entry} "$collectionId" -> "content_entry"
TL;DR
The user encountered an issue where selecting a single relationship attribute in Appwrite returns all relationships. The user provided examples using the `select` method. In the first example, selecting the `mediaThumbnail` relationship attribute also returns the `content` and `assignedToCategories` attributes. In the second example, selecting other attributes returns only those attributes and not the relationships. This issue has been closed, and the reason provided is that queries are not available in relationships in Appwrite version 1.4.2. There is no solution provided in the support thread.
Guille
11 Sep, 2023, 02:17

It because queries are not available in relationship at the moment

Drake
15 Sep, 2023, 20:25

[CLOSED] Selecting single relationship attribute with Query.select returns all relationships

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