我的架构:
Match:
scheduledBy (Pointer to user)
scheduledWith (Pointer to user)
Photo:
owner (Pointer to user)
我想查找没有任何匹配项的用户的照片。
我尝试过的:
let photoQuery = new Parse.Query(MODEL.Photo.className());
photoQuery.include('owner');
// Do not include people who have matches
let matchQuery = new Parse.Query(MODEL.Match.className());
photoQuery.doesNotMatchKeyInQuery('owner', 'scheduledBy', matchQuery);
photoQuery.doesNotMatchKeyInQuery('owner', 'scheduledWith', matchQuery);
// Get final results
return photoQuery.find()
这仅适用于 ScheduledBy 列。
似乎由于某些奇怪的原因,您无法使用相同的键和查询但不同的查询键执行 doesNotMatchKeyInQuery 。
谁能证实这一点?如果是这样,最好的选择是什么?
我删除了scheduledBy并仅使用scheduledWith,效果也很好。所以我相信这不是数据有问题,而是 Parse 的错误。
最佳答案
我认为您的思路是正确的,但我认为问题是使用单个内部查询来限定主查询上的两个字段。这更多的是一种预感,但我认为你会得到你想要的结果......
// use a distinct instance of an inner query for each test in the outer query
let matchQueryBy = new Parse.Query(MODEL.Match.className());
let matchQueryWith = new Parse.Query(MODEL.Match.className());
photoQuery.doesNotMatchKeyInQuery('owner', 'scheduledBy', matchQueryBy);
photoQuery.doesNotMatchKeyInQuery('owner', 'scheduledWith', matchQueryWith);
关于node.js - 解析云代码DoesNotMatchKey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51663576/