So its my first time writing Javascript so please bear with me. I wrote this function in order to query a class in my Parse.com application, and then after querying I want to set one of the columns (of type Boolean) to true.
I set up a test class with only 7 values in order to test.
The problem: only 3 out of 7 are being changed. Do I have to wait after each save? I know that waiting/sleeping in Javascript is "wrong" but I can't seem to find a solution.
Thanks in advance!
Additionally, when using iOS/Parse, I would like to check if the boolean value is undefined in Objective-C, I already tried to compare it to nil/NULL, an exception was thrown
Parse.Cloud.define("setYears", function(request, response) {
var object = new Parse.Query("testClass");
object.find({
success: function(results)
{
for (var i = 0; i < results.length; i++) {
results[i].set("testBool",true);// = true;
results[i].save(null,
{
success:function ()
{
response.success("Updated bool!");
},
error:function (error)
{
response.error("Failed to save bool. Error=" + error.message);
}
});
};
response.success();
}
})
});