Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

What I am trying to do is pull a NON-logged in user from the parse.com user class pull a relational column from that user object. To get the specific user I want here is my code:

 var FollowUser = Parse.Object.extend('User');   
        var query = new Parse.Query(FollowUser);   // Tried to do Parse.User instead of FollowUser
        query.equalTo('username', usernameToFollow);
        query.find({
            success: function(results)
            {

                var relationToUserPosts = user.relation('followUser');

                $scope.userToAdd = results[0];

                relationToUserPosts.add(results[0]);

                user.save();

            },
            error: function(error)
            {
                alert('Error: ' + error.code + '' + error.message);
            }
        });

I can pull relational data from a current logged in user but not a user object. Printing them out to my console and they are different type of objects. I have other code the pulls relational data from the current user logged in, the relation pulls other users and those user objects are the same as the user logged in. Why does using the code above return a different type of user object? Thank you in advance.

UPDATE:

the error happens when I try to pull data from the object and the parent property within the object is undefined.

user object pulled using provided code

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.