user6520705
user6520705

Reputation: 705

Parse server query for object with pointer

Normally when querying for an object with a pointer I use query.includeKey("String"), to be able to access the information that its pointing to in that class.

Recently I needed to access a value from a pointer that was pointed to by another pointer. For example: I have a class in which all likes of a post go to. When a person likes a post I use a pointer to reference the specific post from the Post class which was liked. In my posts class I use a pointer to reference the User class of the user who posted that post. I want to know how I can access that user information from the like class. What I did was I used query.includeKey("posts") and then when I try to access say the users picture from the user object I get a crash.

Upvotes: 0

Views: 726

Answers (1)

nathan
nathan

Reputation: 9395

You can use includeKey for multi-level queries:

// Assuming author is the key name in Posts
query.includeKey("posts.author")

Upvotes: 1

Related Questions