下面是我的JS代码,它应该删除对'Game'对象的指针引用,该对象存储在'team'对象中关键'games'下的数组中。获取工作和下面的所有“成功”日志被调用意味着.remove和.save函数被调用,但由于某种原因,这没有做任何事情,并且指针在执行此代码后仍然存在于数组中。 我做错了什么?
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 from homeTeam array! " + error.code + ": " + error.message);
}
});
},
error: function(myObject, error){
console.error("Error removing game from awayTeam array! " + error.code + ": " + error.message);
}
});