0

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?

3
  • Your question not clear enough, please explain yourself better and add more code. Commented Sep 15, 2015 at 12:56
  • Are you trying to query two different classes using single query? Or you want using the data of the first query in the second query? Commented Sep 15, 2015 at 13:04
  • I want to get the opponents (playerId) selected from 'User' class in a random way, but the condition is that the current user should not have played with the previous 5 users, means the program should not select the random opponent user again and again the same. Commented Sep 15, 2015 at 13:36

1 Answer 1

1

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);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.