Sorting
Results are sorted by orderBy, and can be used on both the root object and nested objects. The orderBy argument takes an array of objects to allow sorting by multiple columns.
The following example gets all patients, ordered by the patient ID in ascending order.
{
patients(orderBy: { id: ASC }) {
person {
firstName
lastName
birthDate
}
}
}This example gets all patients who's ordered by the patient ID in ascending order and for each patient, all their scheduled appointments sorted in descending order.
{
patients(orderBy: {id: ASC}) {
person {
firstName
lastName
}
appointments {
bookings (orderBy: { localStartDate: DESC}) {
localStartDate
localStartTime
}
}
}Was this helpful?
Was this helpful?