Back

How to get specific attribute data of a document using GraphQL instead of complete document.

  • 0
  • Web
  • Databases
  • General
  • Cloud
  • GraphQL
debashish
18 Oct, 2023, 18:40

Can we get only specific attribute data of a document using GraphQL ? so dont need to fetch the whole document data. I need just need the data of particular attribute . I am using graphql.

TL;DR
The user wants to know if it's possible to get specific attribute data of a document using GraphQL. They mention that they are not familiar with GraphQL syntax and share a link to a REST API query. They express frustration about not being able to fetch only the necessary data and ask if there are plans to incorporate this feature. The response suggests creating an issue for this and mentions that it's currently a lower priority item. Unfortunately, it is not currently possible to only fetch specific attribute data using GraphQL as all data is returned in a single field.
Drake
18 Oct, 2023, 18:50

not possible at the moment because the data is returned in 1 field

debashish
18 Oct, 2023, 19:03

That's so disheartening to hear 😦 . I believe this contradicts the fundamental principle of GraphQL, which is to fetch only the necessary data. After all, the main advantage of GraphQL lies in its ability to provide precisely what's needed.

By the way, do you know if there are any plans on the roadmap to incorporate this feature?

Drake
18 Oct, 2023, 19:10

understandable...we had a technical limitation due to the dynamic nature of the API response.

It would be best to create an issue for this. it's in our backlog, but there are other higher priority items at the moment

Drake
18 Oct, 2023, 19:11

you might be able to pass a select query to have the api only return the attributes you want

debashish
18 Oct, 2023, 19:13

oh is it.. you mean. i can still somehow fetch selected attribute data of document. can you provide me the document link. I will read through.

Drake
18 Oct, 2023, 19:14
Drake
18 Oct, 2023, 19:15

although i think that attribute should also be wrapped with double quotes...

Drake
18 Oct, 2023, 19:15

can you confirm? 😁

debashish
18 Oct, 2023, 19:20

this seems to be queries for rest. I hope it can be used with graphql as well.

Drake
18 Oct, 2023, 19:36

Theoretically, you should be able to...I just don't know the syntax because I don't really know graphql 😬

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