2
在我的云代码中,我想要检索“Messages”类中的第一个对象。然后,我想从该对象中获取一些信息,将它发送给另一个类,最后从我最初从它的“消息”类中删除该对象。以下是我的代码,但它不起作用。我应该如何重做?从Parse.com中删除特定对象
我是否应该使用与“destroy”方法不同的方法,如collection.remove?
Parse.Cloud.afterSave("sendMessage", function(Parse.Message, response) {
var body = null;
var senderName = null;
var senderId = null;
var randUsers = [];
var query = new.Parse.Query(Parse.Message);
query.find({
success: function(results){
body.push(results[1].get("messageBody"));
senderName.push(results[1].get("senderName"));
senderId.push(results[1].get("senderId"));
results[1].destroy({
success: function(results[1]){
//the first object in the class "Messages" was deleted
}, error: function(results[1], error){
//the first object was not deleted
}
});
response.success(getUsers);
}, error: funtion(error){
response.error("Error");
}
});
});
为了避免混淆:“getUsers”是一个任意的函数调用。
是的,但如果我使用objectId,我如何从JavaScript代码中的解析云中删除它? – ian 2014-10-06 15:11:50
尊敬的用户2792129,我根据您的评论更新答案。希望这可以帮助。问候。 – kingspeech 2014-10-06 15:58:59
这有助于非常感谢! – ian 2014-10-06 16:11:54