-
-
Notifications
You must be signed in to change notification settings - Fork 596
Cannot get back the full object from the relational field after saving an object #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Which of the two outputs is cloud code, and which is from parse-server? You wrote parse.com twice :) |
Also, please provide which version of the Parse SDK you are using ( |
@andrewimm sorry for confusion! I just updated my comment :P The first one is parse.com and second one is parse-server The parse SDK version is |
Very peculiar. Saving the object shouldn't have side effects on its children. I'll investigate this |
Parse.Cloud.define("testQuery", function(request, response) {
var objectQuery = new Parse.Query(ObjectClass);
var Object; // <-- upperCase `O` and a reserved Javascript constructor
objectQuery.include('user');
objectQuery
.get("_<object_id>_", {useMasterKey: true})
.then(function(_object) {
object = _object; // <-- lowerCase `o` and a leaked global since it´s not declared with var
object.set('user', request.user);
console.log("1 ======> " + JSON.stringify(object.get("user")));
console.log("1 ======> " + object.get("user").getUsername());
return object.save(null, {useMasterKey: true});
})
.then(function() {
console.log("2 ======> " + JSON.stringify(object.get("user")));
console.log("2 ======> " + object.get("user").getUsername());
response.success("");
}, function(error) {
response.error(error);
});
}); I'm guessing your parse server configuration isn't injecting globals even though Parse.com probably does. Try to run this code with |
@carmenlau do you have a |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
We set a complete object to object's relation field, but there is only id leave after saving. Following is the testing code and the output comparison between parse.com and parse-server.
The testing cloud code:
console log of parse.com:
1 ======> {< full user object >}
1 ======> username
2 ======> {< full user object >}
2 ======> username
console log of parse-server:
1 ======> {< full user object >}
1 ======> username
2 ======> {"objectId":"< user id >"}
2 ======> undefined
The text was updated successfully, but these errors were encountered: