我正在使用GraphQl,下面是我的数据
{
"data": {
"food": {
"category": [
{
"id": 4,
"name": "meat"
},
{
"id": 3,
"name": "brink"
},
{
"id": 2,
"name": "vegetable"
},
{
"id": 5,
"name": "bread"
},
{
"id": 1,
"name": "cookie"
},
{
"id": -1,
"name": "candy"
},
]
}
}
}
执行查询时如何排序,返回数据如下所示
{
"data": {
"food": {
"category": [
{
"id": -1,
"name": "candy"
},
{
"id": 1,
"name": "cookie"
},
{
"id": 2,
"name": "vegetable"
},
{
"id": 3,
"name": "brink"
},
{
"id": 4,
"name": "meat"
},
{
"id": 5,
"name": "bread"
},
]
}
}
}
我尝试
{
food {
category(orderBy: id_ASC){
id
name
}
}
}
但显示
食物类型“类别”字段上的未知参数“ orderBy”。
有人知道该怎么做吗?
谢谢。