Skip to content

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

Closed

Description

@carmenlau

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

Activity

  1. flovilmart commented on Apr 5, 2016

    @flovilmart
    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

  2. carmenlau commented on Apr 6, 2016

    @carmenlau
    ContributorAuthor

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

  3. flovilmart commented on Apr 6, 2016

    @flovilmart
    Contributor

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

  4. carmenlau commented on Apr 6, 2016

    @carmenlau
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions