滤波器表达式只能包含非主要密钥属性
我是AWS放大的新手,并为我正在研究的项目创建了一个GraphQl API,以学习它& Appsync。从本质上讲,我有一个看起来如下的模式:
type User @model {
id: ID! @primaryKey
boards: [Board] @hasMany
createdAt: String!
updatedAt: String!
}
type Board @model {
id: ID! @primaryKey
createdBy: User!
title: String!
}
我正在尝试在AppSync控制台中运行以下查询:
query MyQuery {
listUsers {
items {
boards {
items {
title
}
}
}
}
}
但是由于某些原因,我一直看到此错误:
Filter Expression can only contain non-primary key attributes: Primary key attribute: userBoardsId
我已经指定了这两个模型中的主要键,而我' m知道AppSync会生成“用户板”外键,但我不确定为什么会引起问题。
I'm new to AWS Amplify, and have created a GraphQL API for a project that I'm working on in order to learn it & AppSync. Essentially I have a schema that looks like the following:
type User @model {
id: ID! @primaryKey
boards: [Board] @hasMany
createdAt: String!
updatedAt: String!
}
type Board @model {
id: ID! @primaryKey
createdBy: User!
title: String!
}
and I'm trying to run the following query in the AppSync console:
query MyQuery {
listUsers {
items {
boards {
items {
title
}
}
}
}
}
But for some reason I keep seeing this error:
Filter Expression can only contain non-primary key attributes: Primary key attribute: userBoardsId
I've specified the primary key in both models, and I'm aware that AppSync generates the 'userBoardsId' foreign key, but I'm not sure why it's causing an issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你尝试过吗?由于板是数组,您需要添加
项目
编辑:
Have you tried like this? Since boards is array, you need to add
items
EDIT: