Sign In Register

How can we help you today?

Start a new topic

How to delete documents when using game data service on cloud code

Hello everyone,

I would like to know if  there is a way to delete an entire doc when using Game Data Service javascript cloud code.


I am expecting to find out something like


Spark.getGameDataService().deleteItem("MyCustomDataType", myDocID);



Thanks a lot,


William Siqueira


Hi William,


Yes, it's possible to delete an item, you just need to retrieve it first, e.g.:


var item = Spark.getGameDataService().getItem(myDataType, myId);

item.delete();


Regards,

Vinnie


Any other way?

"Function delete does not exist"

image

Done! Vinnie was very close:


var item = Spark.getGameDataService().getItem(myDataType, myId);
var document = item.document();
document.delete();


Thanks and regards

Login to post a comment