I am puzzled by this weird issue. I make a REST API call from my mobile app and then want to execute some code during the before save to set ACL and another field. However, as part of the beforeSave, my dueAt field (of datatype date) is getting reset.
Here is what my console data looks like...
I2014-11-15T23:42:28.577Z] v211: before_save triggered for Message for user AAAAA
Input: {"original":null,"update":{"message":"Some message","createdBy":"AAAAA","dueAt":{"__type":"Date","iso":"2014-11-22T17:42:19-06:00"},...,"ACL":{"AAAAA":{"read":true,"write":true}}}}
Result: Update changed to {"message":"Some message","createdBy":"AAAAA","dueAt":null,"ACL":{"AAAAA":{"read":true,"write":true},"BBBBB":{"read":true,"write":true}},"ownerId":"BBBBB"}
Note that my dueAt was reset to null in the Result. Here is my code for ACL where I am not even setting it in my beforeSave and so this is very baffling....
var groupACL = new Parse.ACL();
console.log("GroupACL value = " + results[0].id);
groupACL.setReadAccess(results[0].id,true); //results has user id from another query that I am executing
groupACL.setWriteAccess(results[0].id, true);
groupACL.setReadAccess(request.user, true);
groupACL.setWriteAccess(request.user, true);
request.object.setACL(groupACL);
request.object.set("ownerId", results[0].id);
I have spent a fair bit of time but cannot figure out why this is happening. Any tips or suggestions would be appreciated.
FYI - Parse confirmed that this was indeed a bug and fixed this issue earlier this week. I was able to verify that this issue cannot be replicated and my code works now. Thanks!