I have Parse _User's with sensitive data on them, so I have the ACL's for Public Read/Write set to false. However, I want to allow users to get some of the user's data, such as their first/last name. I'm doing this through cloud code - where they poll for a user with a specific objectId, but when the cloud code returns, it will censor the sensitive data by changing the fields before it returns to the user. However, it appears that Parse considers this returning of objects "dirty," and refuses to return. Is there a way to return modified objects to users in this fashion (or any other fashion)?
For example, my user object has five (notable) fields.
+----------+-----------+----------+-----------+----------+
| objectId | firstName | lastName | birthdate | username |
+----------+-----------+----------+-----------+----------+
| aBcDeFgH | "Jason" | "Bourne" | "4/15/71" | jbourne |
+----------+-----------+----------+-----------+----------+
When I have it queried, I want to omit the birthdate. To do this in the cloud, I say something along the lines of...
var object = result // result of a Parse.Query.first function
object.set("birthdate", "censored")
return object
And I get the following error.
[Error]: Uncaught Tried to save an object with a pointer to a new, unsaved object. (Code: 141, Version: 1.8.2)
Parse.Cloud.useMasterKey()command to poll the server to bypass the ACL's - that isn't the problem. The problem occurs when I try to return an unsaved PFObject to the user without saving the PFObject - saving the PFObject would overwrite the fields that are still utilized.