Skip to content

Bug in the get method of Query in cloud code #630

Closed
@degenddy

Description

@degenddy

For some reasons, in cloud code:
if I get an object by it's ObjectId and then set it to the reference field of other object it duplicates the object put it entirely in the reference field instead of just setting it's reference.

here's my code (user is from request.object, shoutUser is the one i'm getting with query and "get"):

var userQuery = new Parse.Query('_User');
                userQuery.get("4GJ9QWcecT", {useMasterKey: true})
                    .then(function (shoutUser) {

                        var RefFollowerUser = Parse.Object.extend("RefFollowerUser");
                        var refFollowerUser = new RefFollowerUser();

                        setACLIfNull(refFollowerUser);

                        refFollowerUser.set("user", shoutUser);

                        refFollowerUser.set("follower", user);

                        return refFollowerUser.save(null, {useMasterKey: true});

                    });

So "user" object is set by reference, and "shoutUser" object is copied into the field entirely.
in Parse hosted server it works good, I mean I don't really know how the mongo objects look like, but the ui shows a reference to the user and not the entire json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:questionSupport or code-level question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions