Skip to content

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

Closed

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.

Activity

  1. degenddy commented on Feb 24, 2016

    @degenddy
    Author

    My gut feeling is that somehow the Equals method is different for parse objects than in the Parse hosted server.

  2. degenddy commented on Feb 26, 2016

    @degenddy
    Author

    Any progress on this?
    If you need any other info please ask.

  3. degenddy commented on Mar 3, 2016

    @degenddy
    Author

    Hi guys. Any updates?

  4. nlutsenko commented on Mar 3, 2016

    @nlutsenko
    Contributor

    @daviddayag We had few fixes around this issue in the last update. (specifically #619)
    Can you try out 2.1.4 that was released a few hours ago?

    Also, were you running 2.1.3 or a different version of a server?

  5. degenddy commented on Mar 5, 2016

    @degenddy
    Author

    Hi.
    I upgraded with the last release and now I'm facing different issues.
    I keep getting "object not found." Error when trying to login with the android app.
    I checked and saw that this error comes from the database engine in parse-server.

    DatabaseController.js [row:200] this result object is null. the key searched exists, i checked manually.

    }).then(function (result) {
        if (!result) {
          return Promise.reject(new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Object not found.'));
        }
    
        var response = {};
        var inc = mongoUpdate['$inc'];
        if (inc) {
          Object.keys(inc).forEach(function (key) {
            response[key] = result[key];
          });
        }
        return response;
      });
    
  6. degenddy commented on Mar 6, 2016

    @degenddy
    Author

    any idea?

  7. degenddy commented on Mar 8, 2016

    @degenddy
    Author

    hi guys, did you get a chance to fix this new issue?
    I still can't use the 2.1.4 parse-server.
    Can you give an update?
    Do I need to change something in my android parse SDK?

  8. flovilmart commented on Mar 12, 2016

    @flovilmart
    Contributor

    @daviddayag can you please update to 2.1.6 and provide the requests logs by starting your server with VERBOSE=1 before the start command?

  9. drew-gross commented on Mar 30, 2016

    @drew-gross
    Contributor

    No response in many days, closing.

  10. degenddy commented on Mar 31, 2016

    @degenddy
    Author

    I Didn't see your response. Sorry.
    Yes I upgraded.
    I couldn't check because of the previous case #923.

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

    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