This code works fine:
TypeScript
const doc = await databases.getDocument("main", "users", account.$id, [
Query.select(["premium"]),
]);
But this code throws an error:
TypeScript
const doc = await databases.getDocument("main", "users", account.$id, [
Query.select(["premium", "albums"]),
]);
``` where "albums" is a relationship attribute
The error:
```json
{
"code": 500,
"type": "general_unknown",
"response": {
"message": "Server Error",
"code": 500,
"type": "general_unknown",
"version": "1.5.3"
}
}
And in the logs:
TypeScript
[Error] Method: GET
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
[Error] Type: Utopia\Database\Exception
[Error] Message: Cannot select attributes: albums
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Database.php
[Error] Line: 5249
TL;DR
Error occurs when trying to fetch a document with a relationship query including the "albums" attribute. Server throws a 500 error indicating "Cannot select attributes: albums".Relationship query attribute causes server error.Recommended threads
- Relation Question
How do I create a relation from table y to an others x.$id. in my example I have a users table where I use Appwrites unique User IDs and I want other tables fo...
- Unknown attribute type: varchar / text
Since the `string` type is deprecated I tried using `varchar` and `text` in some newer tables, but when running `appwrite pull tables && appwrite types ./src/li...
- Query.search limitation
Since `string` is deprecated I used `varchar`, and now I cant use `Query.contains` , so I setup fulltext index and started using `Query.search` the issue is `Qu...