Back

Query a relation database

  • 0
  • Databases
  • Flutter
mojarshia
3 May, 2023, 18:11

Hi, I have a one to many relationship between 2 collections. (Products and Catrgories) How can I get the list of documents (Products) that are related to the other collection (categories). I'm using the Futter SDK.

TL;DR
Querying a relational database using Flutter SDK. Currently, it is not fully supported. One way to query is to use `select([])`. However, when fetching the related documents, it automatically returns all attributes of the related documents. If you only want to retrieve the ID of the related documents, you'll need to modify the query.
Drake
3 May, 2023, 19:44

when you fetch, the related documents should be returned automatically...what problem are you facing?

steve jobs
17 May, 2023, 01:47

its returning automatically.. how can i make it to return only the ID of those related documents and not the entire related document?? ie, imagine if products have a relationship category and category is another collection with its own attributes. while fetching products , i only need to get the Id of its category and not the category as a whole. // how to acieve this ?

steve jobs
17 May, 2023, 01:52

got it .. use select([]) right?

Drake
17 May, 2023, 01:54

No, it's not really supported at the moment

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