【问题标题】:How set limit for nested field in AWS amplify DynamoDB schema?如何在 AWS 放大 DynamoDB 架构中设置嵌套字段的限制?
【发布时间】:2020-03-26 21:54:15
【问题描述】:

我有下一个查询

export const listCategorys = `query ListCategorys(
  $filter: ModelCategoryFilterInput
  $limit: Int
  $nextToken: String
) {
  listCategorys(filter: $filter, limit: $limit, nextToken: $nextToken) {
    items {
      id
      name
      words {
        items {
          id
          en
          ru
          statusLearn
        }
        nextToken
      }
    }
    nextToken
  }
}
`;

我想对嵌套元素 words 使用限制并尝试在下一个查询的帮助下获取结果

const listCats = await API.graphql(graphqlOperation(listCategorys, {limit:10, words:{limit:100}}));

但是这个查询不起作用。如何正确构建查询?

【问题讨论】:

  • 我遇到了完全相同的问题,您找到解决方案了吗?

标签: reactjs amazon-web-services react-native graphql aws-amplify


【解决方案1】:

这听起来与Appsync & GraphQL: how to filter a list by nested value 非常相似,因为默认的 Amplify 代码生成只生成顶级过滤器/限制。

这里有一个功能请求,您可能想要投票和评论:https://github.com/aws-amplify/amplify-cli/issues/2311

否则,没有办法在不修改 VTL 模板的情况下立即执行此操作。

【讨论】:

    猜你喜欢
    • 2021-04-13
    • 1970-01-01
    • 2020-04-16
    • 2021-11-05
    • 2013-03-24
    • 2019-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多