Download

GameSparks LogEvent fails

i can´t show my values it is in nosql database
my event call getchar

this is my code i use cloude code
what i doing wrong



var Name=Spark.getData().Name;
var collection= Spark.runtimeCollection("character");
// get the type we passed in
if(Name != ""){
// collection.find({ "Name" :Spark.getData().Name });
// if the type wasnt an empty string, then we can use the type in our query
//Spark.setScriptData('character', collection.find({ "Name" : name }, {"_id" : 0}));
var cursor =collection.find({ "Name" : Name })
Spark.setScriptData('data',cursor)
}
else{
// collection.find();
// if the type was an empty string, we can forget the query as we just want to return everything
//collection.find();
var cursor=collection.find({})
Spark.setScriptData('data',cursor)
//Spark.setScriptData('character', collection.find());
}