Back

[SOLVED] Query does not work on collections that has relationships with other collections

  • 0
  • Databases
  • Accounts
kstulgys
29 Jun, 2023, 07:52
TypeScript
    const res = await db.listDocuments(dbName, 'users', [
      Query.equal('$id', [meta.$id]),
      Query.orderDesc('recipients'),
      Query.orderDesc('addresses'),
    ]);
    console.log({ res });

This does not work. recipients and addresses are separate collections that has relationship with users

I'm trying to be efficient querying users recipients and addresses but it seems I will need todo a separate query for recipients and addresses if I need to sort it.

TL;DR
The user is experiencing an issue with querying collections that have relationships with other collections. The user provides a code snippet where they are trying to query the "users" collection and sort by "recipients" and "addresses" which are separate collections with relationships to "users". The user mentions that this approach does not work and they would need to perform separate queries for "recipients" and "addresses" if they want to sort them. Solution: The user is informed in a previous message that querying is currently not available in the beta version of Appwrite Relationships, but will be added in a later version. The user is directed to refer
Bouahaza
29 Jun, 2023, 10:49
kstulgys
29 Jun, 2023, 13:42

Well this url doesn't give any insights to my question

Guille
29 Jun, 2023, 15:10

He is referring to the text: Querying is currently not available in the beta version of Appwrite Relationships but will be added in a later version.

Drake
30 Jun, 2023, 16:40

[SOLVED] Query does not work on collections that has relationships with other collections

kstulgys
30 Jun, 2023, 18:04

ok, thanks

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