i'm just experiencing parse sdk and i wanted to use cloud code to increment a Number column whenever a relationship between two tables added by client(for example user likes a post) , in parse documentation there is just codes for incrementing a column based on saving an object and not a relation between tables using afterSave :
Parse.Cloud.afterSave("Comment", function(request) {
query = new Parse.Query("Post");
query.get(request.object.get("post").id, {
success: function(post) {
post.increment("comments");
post.save();
},
error: function(error) {
console.error("Got an error " + error.code + " : " + error.message);
}
});
});
how can i use afterSave on changing relation between two tables? any help would be appreciated.