Back

GraphQL magic doesn't work on data attribute of list documents

  • 0
  • GraphQL
  • Web
Vishal Lohar
30 Dec, 2023, 12:09
TypeScript
    databasesListDocuments(
        databaseId: "[DATABASE_ID]",
        collectionId: "[COLLECTION_ID]"
    ) {
        total
        documents {
            _id
            _collectionId
            _databaseId
            _createdAt
            _updatedAt
            _permissions
            data
        }
    }
}

This query is great but I can't decide what I want in data. Maybe I am fetching all blog posts but I just need the title of all the posts. How can I do it using GraphQL..

TL;DR
The user wants to retrieve only the title from a list of documents using GraphQL, instead of retrieving the entire data attribute. The solution is to modify the query to include only the desired fields.
Drake
30 Dec, 2023, 18:31

The title should be there in data. You'll need to JSON decode it

Vishal Lohar
2 Jan, 2024, 09:46

Yes. I know that the title will be available in the data. But what if I just want the title?

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