How can i find player's matches that saved in matchInstance collection using Cloud Code?
What exactly are you trying to achieve here ? Normally we wouldn't recommend accessing a system collection like this as it's an unsupported method, if you let us know what you're trying to do here we can help you find a solution.
For a game, a player will have multiple turnbased matches. i want to get the list of these matches.
For another game a player should have only one match. so i will check if this player has another match.
You could use Challenges for this, challenges can be set to be turn based. They can also be searched for with a FindChallengeRequest, the response of which will contain challenges that the player is eligible to join.
are not challanges for known players(friends)? i want to set matches for everyone.
i just need system collections as read only. using this undocumented function helps me to solve many problems. i hope you released this function :-)
i try this code and count is always zero. i can see there are matchInstance record on NoSQL interface. i also tried Spark.runtimeCollection. i use this code in a custom event cloud code.
var matchCollection = Spark.metaCollection("matchInstance"); var count = matchCollection.count();