I have a question relating to sorting with a nested key, and filtering at the same time. This is a Q&A (question and answer) kind of application like Stack Overflow. Here is the schema.
type Question {
title: string
description: string
owner: User
answers: [Answer]
createdTs: datetime
}
type Answer {
description: string
owner: User
createdTs: datetime
}
type User {
firstName: string
lastName: string
}
answers: [uid] @reverse .
owner: uid @reverse .
I want to create a query to fetch “My Answers”, which should return the questions, to which a particular user posted answers, and the questions to be sorted by the order of the created time of the answer. So, that I can see the question to which I posted an answer recently, on the top.
This is a common use case, like the Stack Overflow’s My Answers section. Can someone help me out? I have tried several methods, but nothing gives exactly what I’m looking for.