Sign In Register

How can we help you today?

Start a new topic
Answered

Removing Matches after players have left

Hi,

I am trying to delete completed matches after all players have left but have been unable to do so.  I can only remove the matches from the database via the NoSQL interface.


Is there a way to do this programmatically either in client code or cloud code?


I successfully remove players from a completed match with the following cloud code where I supply matchID and playerID:

var match = Spark.getMultiplayer().loadMatch(matchID);
match.removePlayersById(playerID);

 I would like to run the following cloud code:

var matchInstances = Spark.systemCollection("matchInstance");
var query = { "_id": matchID };
matchInstances.remove(query);

but it errors with "Function remove does not exist".


I am calling both of the above using Event scripts.


I am hoping there is a way to delete the matches after they have been completed as we would potentially get thousands of matches left in the database and would surely be a resource hog!


Thanks in advance!


Best Answer

Hi Simon,


You don't have to worry about removing anything from system collections. They are indexed appropriately so can grow to any size required. If your game has any unusual activity that causes them to grow to an extremely large size we'll be in contact to advise how to handle such an issue.


Regards,

Liam

1 Comment

Answer

Hi Simon,


You don't have to worry about removing anything from system collections. They are indexed appropriately so can grow to any size required. If your game has any unusual activity that causes them to grow to an extremely large size we'll be in contact to advise how to handle such an issue.


Regards,

Liam

Login to post a comment