Skip to content

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

Closed
@carmenlau

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

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