Dave Gavigan
Dave Gavigan

Reputation: 156

How to fetch relations for a given user in parse-server

Trying to fetch relations for a user via the parse REST api

I have a class called Interest containing simple text fields (music, art, movies, etc)

My query:

/classes/Interest/?where={"$relatedTo":{"object":{"__type":"Pointer","className":"User","objectId":"<userObjectId>"},"key":"interest"}}

I would expect this to return those interest associated with the given user objectID. I keep getting an empty array.

When I try a similar query against a class that is not the reserved User it performs as expected.

Am I missing something or might this be a bug? Any help would be appreciated!

Upvotes: 2

Views: 448

Answers (1)

Dave Gavigan
Dave Gavigan

Reputation: 156

Figured it out. If using the User class, you need to add an underscore as its a reserved class. _User

Upvotes: 2

Related Questions