Back

Query in Relationships

  • 0
  • Databases
  • Flutter
Dipen
24 Jul, 2023, 04:28
TypeScript
await database.listDocuments(
    databaseId: dbId,
    collectionId: collId,
    queries: [
      Query.orderDesc("\$id"),
      Query.equal("categories", [categoryId]),
    ],
  );

I have added relationship with category collection and productscollection and now I want to get the list of products of specified category only!

Result: AppwriteException: general_unknown, Server Error (500)

TL;DR
The user is facing a problem with querying relationships in the Appwrite platform. They are in a time crunch for their project and are frustrated with having to rewrite all the tables. They ask if there are any alternatives to querying relationships. The solution is that querying is not currently available in the beta version of Appwrite Relationships but will be added in a later version. A code snippet is provided for reference. The user encounters a server error (500) when trying to implement the solution.
Binyamin
24 Jul, 2023, 04:29

Querying is currently not available in the beta version of Appwrite Relationships but will be added in a later version.

Dipen
24 Jul, 2023, 04:38

is there any alternative then?

Binyamin
24 Jul, 2023, 04:40

For now?

Binyamin
24 Jul, 2023, 04:40

Only in mimicked relationships

Dipen
24 Jul, 2023, 04:42

πŸ₯±πŸ₯΄ I'll have to rewrite all the tables now 😦

Binyamin
24 Jul, 2023, 04:42

πŸ˜• doesn't sound like fun

Dipen
24 Jul, 2023, 04:43

should have used other platforms for client's project! I'm tight on deadline

Binyamin
24 Jul, 2023, 04:45

For now to be able to finish the project You can iterate over all the products and add the categories to a new search attribute sepreate with space

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