javascript - Graphql错误: "using last without before is not supported"

标签 javascript ecmascript-6 graphql shopify

我正在使用 Gatsby + GraphQL + Shopify。我在过去 10 天内检索我的订单时遇到问题。
我的查询如下所示:

query {
   customer(customerAccessToken: "${customerAccessToken}") {
      orders(last: 10) {...}
   }
}
它返回这个:

"message": "using last without before is not supported"


我注意到这个问题发生在其他一些开发人员身上:https://community.shopify.com/c/Shopify-Discussion/How-to-get-customer-s-orders-and-sort-by-date-in-descending/m-p/629133/highlight/false#M151241
如果您查看文档,它没有说明使用 beforelast :
https://shopify.dev/docs/admin-api/graphql/reference/object/order?api[version]=2020-07
底部有一个游乐场,您可以在其中测试查询。
其他人以前见过这个问题吗?

最佳答案

在操场上玩了一会儿之后……您可以使用 解决方法 - reversefirst

{
  orders(first: 10, reverse:true) {
    edges {
      node {
        id
        createdAt
      }
    }
  }
}

关于javascript - Graphql错误: "using last without before is not supported",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62765178/

相关文章:

javascript - Three.js 在 iPad Air 2 上无法正确渲染

javascript - React - 播放音频 onClick 在 iOS 设备上导致 "Unhandled Rejection (NotAllowedError)"?

javascript - Promise.all() 方法未解析为值

Javascript 嵌套解构语法

graphql-dotnet VS graphql-net - 哪个库对于从数据库获取/写入数据很有用

graphql - 突变 - 批量创建对象

graphql - 是否可以使用 Graphql 和 Sequelize 进行 Multi-Tenancy ?

javascript - 如何使用Graph API获取我所在城市的事件?

javascript - 单击链接时水平滚动

javascript - 使用@viewchild时无法读取 Angular 中未定义的属性 'nativeElement'