在AWS appsync / amplify中是否可以合并过滤器运算符,例如:
const filterInput = {
or:[
{
and: [
{createdById: { eq: userID }},
{chatWithId: { eq: chatWithUser.id }}
]
},
{
and: [
{createdById: { eq: chatWithUser.id }},
{chatWithId: { eq: userID }}
]
}
]
}
因为对我来说,这无法按预期进行过滤/工作。
答案 0 :(得分:0)
感谢您提供其他信息。使用如下所示的Amplify模式:
type Chat @model {
id: ID!
createdAt: String
createdById: String
chatWithId: String
messsages: [Message]
}
默认情况下,将创建一个带有存储ID值的HASH键的表来存储值,并且无法有效地运行您尝试仅使用默认键结构运行的查询。将来,您将拥有更多可用的工具来控制@model表的索引结构,但目前唯一的方法是通过@connection。
这是一个示例架构,可以帮助您开始构建可以更有效地查询这些关系的API。