amazon-web-services - aws appsync 组合过滤器运算符
问题描述
AWS appsync / amplify 是否可以组合过滤器运算符,例如:
const filterInput = {
or:[
{
and: [
{createdById: { eq: userID }},
{chatWithId: { eq: chatWithUser.id }}
]
},
{
and: [
{createdById: { eq: chatWithUser.id }},
{chatWithId: { eq: userID }}
]
}
]
}
因为对我来说这不是过滤/按预期工作。
解决方案
感谢您提供额外的信息。使用如下所示的 Amplify 架构:
type Chat @model {
id: ID!
createdAt: String
createdById: String
chatWithId: String
messsages: [Message]
}
默认情况下,会创建一个带有存储 id 值的 HASH 键的表来存储这些值,并且无法有效地运行您尝试仅使用默认键结构运行的查询。将来,您将拥有更多可用于控制@model 表的索引结构的工具,但目前唯一的方法是通过@connection。
这是一个示例模式,可以帮助您开始构建可以更有效地查询这些关系的 API。
推荐阅读
- javascript - 如何在html网页中提取excel数据
- javascript - 如何在firebase中使用异步和等待来验证用户
- react-native - 如何将 React Native “index.android.bundle” js 代码转换为二进制格式?
- javascript - 打字稿抱怨反应组件可选道具可能未定义
- java - 你能帮我找出这个Java代码中的错误吗
- c++ - 如何通过引用另一个需要具有相同参数和相同返回的函数的库函数来传递对象函数
- html - 如何在 Angular 中执行函数之前等待最后一次击键?
- amazon-web-services - 如何在AWS athena中将多行拆分为单行但多列
- java - 当我从参数接收到 Iterable 时,如何使用带有 java8 的 Lamba 表达式从给定值中找到最接近的数字?
- robotframework - 如果运行关键字失败,Robot Framework 可以运行保留关键字吗?