You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I modified few attributes on an object and saved it.
gameScore.score = 2061
gameScore.save()
When querying from beforesave cloud code, request.object.dirtyKeys() returns all keys dirty... instead of just the modified keys.
The text was updated successfully, but these errors were encountered:
This bug is due to the way ParsePy currently saves Objects--by sending a PUT request with the entire object's data, thus resaving every field. The way other SDKs (such as the JavaScript SDK) implement saving is by keeping a running tally of all changes made to the object, and only sending only those changes to the server.
I can work on this, but it might take up to a week to fix. In the meantime, is it possible to write the beforeSave cloud code to work around using dirtyKeys, maybe by comparing fields to the object's previous fields? Something like:
query = new Parse.Query("GameScore");
query.get(request.object.id, {
success: function(oldObject) {
if (request.object.get("score") !== oldObject.get("score")) {
// score is dirty
}
},
error: function(error) {
console.error("Got an error " + error.code + " : " + error.message);
}
});
It's an extra database hit, but it might work for now.
That would be awesome, saves a lot of pain. I was in a hurry to get it working; so, stored a separate attribute in the table as shootMail. If I modify the values I intend to shoot mail I put it to true and later in the cloudcode shoot the mail and revert it back to false. That does the job for now, but it would be helpful to shoot different mails based on the attributes changed with out much work in the client code.
I modified few attributes on an object and saved it.
gameScore.score = 2061
gameScore.save()
When querying from beforesave cloud code, request.object.dirtyKeys() returns all keys dirty... instead of just the modified keys.
The text was updated successfully, but these errors were encountered: