hydra
v3
v3
  • Hydra
  • Hydra CLI
  • Hydra Indexer
  • Hydra Indexer Gateway
  • Hydra Processor
  • Hydra Typegen
  • Overview
    • Query Node Manifest
    • Graphql Queries
    • Pagination
    • Sorting
    • Mappings
      • Context interfaces
      • Mapping Filters
      • Mapping Types
    • Schema
      • The Goodies
      • Entities
      • Enums
      • Interfaces
      • Algebraic types
      • Full-text queries
      • Entity Relationships
      • Cross filtering
      • Variant relations
    • Architecture
  • Install Hydra
  • Migration to Hydra v2
  • What's new in Hydra v3
  • FAQ
  • Quickstart
Powered by GitBook
On this page

Was this helpful?

  1. Overview

Sorting

Results from your query can be sorted by using the orderBy argument.

The sort order (ascending vs. descending) is set by specifying the asc or desc enum value for the column name in the orderBy input object, e.g. title_DESC.

The orderBy argument takes an array of field to allow sorting by multiple columns.

Sorting entities

Example: Fetch a list of videos sorted by their titles in an ascending order:

query {
  videos(orderBy: [title_ASC]) {
    id
    title
  }
}

Sorting entities by multiple fields

Example: Fetch a list of videos that is sorted by their titles (ascending) and then on their published date (descending):

query {
  videos(orderBy: [title_ASC, publishedOn_DESC]) {
    id
    title
    publishedOn
  }
}
PreviousPaginationNextMappings

Last updated 3 years ago

Was this helpful?