Reputation: 1794
I would like to know in cloud code if the request is adding or removing an item from a ParseRelation. How to get information from the Parse Operation. For now I cannot get any information from Parse.Op.
for i.e : in a beforeSave() method :
var parseOp = myObject.op('myRelation');
if (parseOp != null) {
console.log("Operations on myRelation = " + parseOp.toJSON() );
}
in log this display only : Operations on myRelation = [object Object]
There is no information in Parse SDK js documentation. on how to use ParseOp.
Upvotes: 0
Views: 193
Reputation: 666
Check out the issue here regarding this:
https://github.com/ParsePlatform/Parse-SDK-JS/issues/133
If you still want to use .op
you can try something like this:
var parseOp = myObject.op('myRelation');
if (parseOp) {
console.log('array of objectIds to add', parseOp.relationsToAdd)
console.log('array of objectIds to remove', parseOp.relationsToRemove)
// do more things here
}
Note: you can pass multiple arguments to console.log(...)
and objects will be printed out
Upvotes: 2