解析云代码DidNotMatchKey

时间:2018-08-02 23:51:24

标签: 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()

这仅适用于scheduleBy列。

由于某些奇怪的原因,您似乎无法使用相同的键和查询但使用不同的查询键来执行dosNotMatchKeyInQuery。

任何人都可以确认吗?如果是这样,什么是最好的选择?

我删除了cheduleBy,只使用了cheduleWith,效果也很好。因此,我认为数据并没有什么问题,这是Parse的错误。

1 个答案:

答案 0 :(得分:0)

我认为您走在正确的道路上,但我认为问题在于使用单个内部查询来限定主查询中的两个字段。这有点预感,但是我想您会得到想要的结果……

// 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);
相关问题