Prime_Coder
Prime_Coder

Reputation: 161

Parse.com cloud code query 2 class results

In my project, I've 2 classes - gamePlayer and User. In gamePlayer, I've created pointer called playerId to hold the pointer value to the User class. When I query both classes seperately in cloud code, it works correctly. Now, i'm trying to query the gamePlayer class with the constraint

query.notEqualTo("playerId", request.params.id);

it gives the players which will be opponents for the current user. How can I get the result of both the queries in a single cloud code function?

Upvotes: 0

Views: 58

Answers (1)

Russell
Russell

Reputation: 3089

Use request.user in cloud code to get the calling user.

Since playerId is a pointer to users, all you need to do is:

query.notEqualTo("playerId", request.user);

Upvotes: 1

Related Questions