Back

query relationship

  • 1
  • Web
moe
16 Nov, 2023, 16:23

hey guys, I know query doesn't support relational field yet, so my idea was to try graphQL to get exact data I need from inside that relationship field but couldn't get anywhere. I tried something like graphql.query({ query: ` query { databasesListDocuments( databaseId: "[id]", collectionId: "[colId]" ) { total documents { _id, data { attachmentType, attachmentURL, body, user_id { _id avatar firstname lastname username } } } } } but that didn't work.. I really don't want to return the whole obj as it will have so many unnecessary data but not sure how, is there anyway around that? I'm building react Native app btw

TL;DR
The user is asking about support for relationships and querying for specific data within those relationships. They mention that there is limited support with GraphQL but the data is returned as a string, not an object. The user tried using a GraphQL query but it didn't work. They don't want to return the whole object as it would have unnecessary data. They are building a React Native app. Solution: Currently, relationships are not supported. The user can either wait for queries to be supported or manually fetch the related data. There is no solution provided for the GraphQL query not working or only returning the necessary data.
Drake
18 Nov, 2023, 03:22

There's also limited support with graphql and selecting the data. If you notice, the data is returned as a string, not an object so you can't select different attributes.

For the moment, you'll have to wait for queries to be supported. Or, you can stop using relationships and manually fetch related data

moe
18 Nov, 2023, 04:45

got it, thanks Steven

fafa
18 Nov, 2023, 16:22

Is there a rough ETA on when relationships are supported? c:

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