代码之家  ›  专栏  ›  技术社区  ›  mocode10

解析云代码DoesNotMatchKey

  •  1
  • mocode10  · 技术社区  · 6 年前

    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列。

    有人能证实吗?如果是的话,最好的选择是什么?

    我删除了scheduledBy,并使用scheduledWith only,这也起到了作用。所以这不是数据有问题,我相信是解析的错误。

    1 回复  |  直到 6 年前
        1
  •  0
  •   danh    6 年前

    // 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);