javascript - Parse Cloud Code returns pointer instead of object after save -
problem:
i'm trying return full object, instead keep getting pointer back. think might because modify object, save, return in response. how able modify, save, , return full object , not pointer?
code: relevant code shown:
getpicture(username, { success: function (pictureobject) { response.success(pictureobject); //always getting pointer }, error: function (error) { response.error(error); } }); ... function getpicture(username, callback) { var pictures = parse.object.extend("pictures"); var pictures = new parse.query(pictures); pictures.equalto("username", username); pictures.find({ success: function (results) { var object = results[0]; object.increment("views", 1); object.save(); //i think issue here callback.success(object); }, error: function (error) { callback.error(error); } }); }
thank you!
you have take object after parse save in database.
try using
object.save().then(function(newobject){ callback.success(newobject); });
this send object after save.
Comments
Post a Comment