Strapi.io graphQL nested sorting

System Information
  • 3.1.6:
  • windows:
  • postgres:
  • 12.14.1:
  • 6.13.4:
  • Yarn Version:

My products database schema is something like this.

products:{
  id:
  name:
  color:[colors]
}
colors:{
  id:
  name:
  price:
}

I want a select query that sorts the product list according to the nested field ‘color.price’.
color field has 1 to many relationships with colors table.

I tried this but didnt work sort: "color.price:asc"

How can I do that?

The idea you are going with is correct to sort and it works.
But I think you may just have a typo. Did you try it as plural:
"colors.price:asc".

So in a sample GraphQL query, I tried it and it works:

query{
 products(sort: "colors.asc"){
  id
  name
  colors{
   name
   price
  } 
}
}