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
C
Customer Support
said
over 5 years ago
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
Customer Support
said
over 5 years ago
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.
Simon Hill
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:
I would like to run the following cloud code:
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!
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
Customer Support
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
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics