解析-云代码中查询的限制结果

时间:2018-06-19 12:33:00

标签: javascript parse-platform

您好,使用Parse Cloud Code可以在注释中使用此代码吗?

Parse.Cloud.beforeFind('Note', function(req) {
    var query = req.query; 
    var user = req.user; 
    // if a given 'Note' visibility is set to 'Unlisted' 
    // return only the Notes with 'user' field that the calling _User 
});

documentation仅显示如何过滤返回的字段,而不能完全从Cloud Code的查询结果中删除项目。

我知道这可以通过ACL来完成,但是需要注意的是,如果请求是 retrieve 函数而不是 query ,则该注释仍应返回。

1 个答案:

答案 0 :(得分:1)

假设您已将用户保存为对象关系(不是字符串ID)。只需添加您需要的资格,例如:

query.equalTo("your_user_pointer_col_on_Note", user)