[英]Parse server Java script Cloud code Error : [TypeError: A ParseQuery must be constructed with a ParseObject or class name.]
I am trying to run a cloud code function to query the server and get a list of users from a class called ROOMS. 我正在尝试运行云代码功能来查询服务器并从名为ROOMS的类中获取用户列表。 I want to then use the value "USER" of the objects that are found to run another query in which I send push notifications to those users.
然后,我想使用找到的对象的值“ USER”来运行另一个查询,在该查询中我向这些用户发送推送通知。
Here is the code that I have so far, I am used to writing in SWIFT so I am not too good at javascript 这是到目前为止的代码,我习惯于在SWIFT中编写代码,所以我不太擅长javascript
Parse.Cloud.define("chatNoti", function(request,response){
var userQuery = new Parse.Query(Parse.ROOMS);
userQuery.equalTo("roomName",request.params.roomname);
var message = request.params.message;
var pushQuery = new Parse.Query(Parse.Installation);
pushQuery.containedIn("user","USER",userQuery);
Parse.Push.send({
where: pushQuery,
data : {
alert: message,
"badge": 1,
}
}, {
success: function(result) {
console.log(JSON.stringify(result));
response.success(result);
},
error: function(error) {
console.error(JSON.stringify(error));
response.error(error.message)
},
useMasterKey: true
});
});
I believe Parse.ROOMS does not exist try replacing with “ROOMS” if thst's The name of your collection. 我相信Parse.ROOMS不存在,请尝试使用“ ROOMS”代替,如果它是您的收藏名称。 Note that collection names are case sensitive.
请注意,集合名称区分大小写。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.