I am using Parse cloud code to clear all pointers to a "Tag" object when the tag is deleted. "beforeDelete" is called and I don't get any errors + The console prints the correct "Song" objects" that has the pointer to the deleted "Tag".
But the pointer is not removed from the Array.
Parse.Cloud.beforeDelete("Tag", function(request, response) {
var query = new Parse.Query("Song");
query.equalTo("tags", request.object);
query.include(["tags"]);
query.find({
success: function(songs) {
console.log(songs);
for (var i = 0; i < songs.length; i++) {
songs[i].remove("tags",request.object);
songs[i].save();
};
response.success();
},
error: function(error) {
response.error(error);
}
});
});
What am I doing wrong ?
Thanks Shani