我需要查询所有未完成的项目,在完成后,将为项目提供状态更改(Completed
)和布尔值isComplete==true
。
我正在通过AWS Appsync来测试查询,然后再将其硬编码到我的应用程序中,但这似乎并不有效。我想要所有isComplete==false
或isComplete==null
的项目:布尔逻辑不适用于下面的input1
变量(0个结果)。
{"__typename":{"S":"Project"},"addressLine1":{"S":"321 Faith Cir"},"city":{"S":"Perris"},"createdAt":{"S":"2019-03-05T01:01:39.513Z"},"currentOwner":{"S":"pgres52"},"dateRequired":{"S":"2019-03-13-07:00"},"id":{"S":"89a5-42ef7efef8fb"},"status":{"S":"Created"},"statusLastChangedAt":{"S":"2019-03-05T01:01:39.513Z"}}
{
"input1":{
"isComplete": {
"ne": true
}
}
}
query listNonCompleteProjects($input1: ModelProjectFilterInput) {
listProjects(filter: $input1, limit: 20) {
items {
id
currentOwner
addressLine1
city
dateRequired
isComplete
statusLastChangedAt
}
nextToken
}
}```
答案 0 :(得分:1)
解决了!对此帖子提供了部分帮助:Prisma.io: How do I filter items with certain fields being null?
我能够使其与附加参数status
(字符串)一起使用:
query listNonCompleteProjects($input1: ModelProjectFilterInput) {
listProjects(filter: $input1, limit: 20) {
items {
...
}
}
}
"input1":{
"and": [
{"status": {"notContains": "Complete"}},
{"isComplete": {
"ne": true
}}
]
},