I am trying to add an object to a PFRelation in Cloud Code. I'm not too comfortable with JS but after a few hours, I've thrown in the towel.
var relation = user.relation("habits");
relation.add(newHabit);
user.save().then(function(success) {
response.success("success!");
});
I made sure that user
and habit
are valid objects so that isn't the issue. Also, since I am editing a PFUser
, I am using the masterkey:
Parse.Cloud.useMasterKey();