Skip to content
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

Cannot get back the full object from the relational field after saving an object #1377

Closed
carmenlau opened this issue Apr 5, 2016 · 4 comments

Comments

@carmenlau
Copy link
Contributor

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:

Parse.Cloud.define("testQuery", function(request, response) {
  var objectQuery = new Parse.Query(ObjectClass);
  var Object;

  objectQuery.include('user');
  objectQuery
  .get("_<object_id>_", {useMasterKey: true})
  .then(function(_object) {
    object = _object;
    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);
  });
});

console log of parse.com:
1 ======> {< full user object >}
1 ======> username
2 ======> {< full user object >}
2 ======> username

console log of parse.com:
1 ======> {< full user object >}
1 ======> username
2 ======> {"objectId":"< user id >"}
2 ======> undefined

@flovilmart
Copy link
Contributor

Seems to be an issue in the JS SDK more than parse-server. cc: @andrewimm.

I suggest you open it on https://github.com/parseplatform/Parse-SDK-JS/issues

@carmenlau
Copy link
Contributor Author

@flovilmart The problem that I mentioned happen in cloud code, not JS client. :P

@flovilmart
Copy link
Contributor

yeah, but this is the JS client running Cloud Code...

@carmenlau
Copy link
Contributor Author

I got what you mean! Will open issues there, thanks @flovilmart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants