从Cloud Code,我如何查询与一组用户匹配的安装?

Gab*_*man 7 parse-cloud-code parse-server

我正在使用独立的Parse服务器,尝试向多个安装发送推送通知.

解析服务器不允许我从Cloud Code查询安装集合,返回以下错误:

Error handling request: ParseError {
  code: 119,
  message: 'Clients aren\'t allowed to perform the find operation on the installation collection.' } code=119, message=Clients aren't allowed to perform the find operation on the installation collection.
Run Code Online (Sandbox Code Playgroud)

Cloud Code中的查询如下所示:

var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.containedIn('user', users);
pushQuery.find({ ...
Run Code Online (Sandbox Code Playgroud)

获取一组用户的安装列表并将推送发送到所有用户的正确方法是什么?

我还尝试通过Parse.Cloud.useMasterKey();在查询之前立即调用来使Cloud Code使用masterKey .没有效果,主密钥不包含在查询请求标头中.

Cli*_*dwh 5

这是因为Parse.Cloud.useMasterKey()自Parse-server版本2.3.0以来已弃用.您现在需要useMasterKey: true在查询中使用.

例如:

var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.containedIn('user', users);
pushQuery.find({useMasterKey: true }).then(function(results) {
Run Code Online (Sandbox Code Playgroud)