parse.com - Deleting object from array in Parse Cloud Code (Javascript) -


below js code supposed delete pointer reference 'game' object stored in array under key 'games' in 'team' object. fetching works , 'success' logs below called meaning .remove , .save functions called, reason, not , pointers still exist in arrays after execution of code. doing wrong?

var queryteam = request.object.get("awayteamid");  queryteam.fetch({     success: function(awayteam){          console.log("success in fetching awayteam object. destroying now.");          awayteam.remove(awayteam.get("games"), request.object);         awayteam.save();          var queryteam = request.object.get("hometeamid");          queryteam.fetch({             success: function(hometeam){                  console.log("success in fetching hometeam object. destroying now.");                   hometeam.remove(hometeam.get("games"), request.object);                 hometeam.save();             },             error: function(hometeam, error){                 console.error("error removing game hometeam array! " + error.code + ": " + error.message);             }         });     },     error: function(myobject, error){         console.error("error removing game awayteam array! " + error.code + ": " + error.message);     }  }); 

your approach removing incorrect, don't need fetch array remove it, remove request should made on object:

awayteam.remove("games", request.object); 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -