node.js - 解析云代码DoesNotMatchKey

标签 node.js parse-server

我的架构:

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/

相关文章:

c++ - Docker compose libstdc++.so.6 GLIBCXX_3.4.21 未找到

node.js - ECS Fargate 任务在使用 Terraform 创建时无法通过健康检查

mysql - Sails.js 协会

node.js - 错误 : Cannot connect to runtime; make sure that runtime is in 'legacy' debug mode

node.js - 如何修复 openshift 中解析服务器的 8080 端口不可用错误

ios - Parse Server(由 Azure 托管)不支持匿名登录?

node.js - 如何使用 Azure 服务总线和 Node.js 监听队列?

iOS 通过单击按钮在解析服务器连接之间切换

swift - 从解析本地数据存储中删除对象 unpinAll 不起作用

java - 如何将 PDF 文件上传到 Parse 服务器?