Back

Query between multiple collection

  • 0
  • Databases
  • Web
debashish
30 Oct, 2023, 08:27

I have a collection called "user_personal_info" which has attributes like. $id, name, age, etc. I have another collection called. "user_professional_info" which has attribute like $id, worktype, city_name etc.. I have more similar related collection. the common thing between this collection is that all document in this collection share the common $id.

My question is..

  1. how to write query to fetch the doucments who are between the age of 25 to 30 and whose city is "bangalore" and then filter it down further. because all information are in different different collection.
  2. how pagination would work in this situations. because with above approach each collection would have its own results sets with paginated data.

What I am basically looking for is chaining of Query between mutliple collection without making multiple api calls. essentialy passing the result of one collection to another to refine my results. currently I believe query chaining between collection doesnt work.

let me know if I am wrong..

TL;DR
The user is requesting support for querying between multiple collections in an app called Appwrite. They mention that this feature is important when working with related data and hope it will be added soon. They mention that they have stopped their projects because of this issue and have created a temporary solution using cloud functions. They suggest combining the data into a single collection or querying one collection and then querying the other to keep only the overlapping records. They ask if there are any workarounds and if this feature is being worked on. Unfortunately, at the moment, querying between collections is not possible. Pagination would also be challenging in this situation. No solution is mentioned
Drake
31 Oct, 2023, 01:29

unfortunately, you can't do this at the moment. maybe after we add additional support for querying relationships, this will be possible

debashish
31 Oct, 2023, 07:18

any workaround...?? you can suggest. also is work already going on to have this feature in appwrite ??

debashish
31 Oct, 2023, 07:19

I guess this is a very common scenario many people would face.

ideclon
31 Oct, 2023, 15:15

I guess you could first query one, then query the other, then only keep records that are in both responses

Drake
1 Nov, 2023, 04:58

Or combine data into a single collection

debashish
4 Nov, 2023, 06:19

this is okay if there are two or 3 collection with less data but when there is more than 5 collection with huge data.. thats a huge task. only better way is to combine in one collection.

ideclon
5 Nov, 2023, 00:13

Absolutely

Champinhoo
5 Nov, 2023, 09:32

This is a serious problem, which made me stop all the projects I was migrating to appwrite, I have to display the related objects according to the status of those objects...

I made an alternative solution using cloud functions, but it’s bad to imagine that it’s something temporary and it gives the feeling that it’s going to explode at any moment...

Champinhoo
5 Nov, 2023, 09:35

I know that the team is dedicated and has its concerns, but this is a mandatory thing when working with related data, I hope to see this soon or that they give it a high priority...

Because I love the appwrite...

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