javascript - Updating many objects at once using Parse Cloud Code -
i need update particular fields of multiple objects stored in class. can client, don't idea of handling bandwidth. how can update , save objects i've iterated on in cloud code query? essentially, what's js equivalent of following swift method?
var query = pfquery(classname:"gamescore") query.wherekey("playername", equalto:"sean plott") query.findobjectsinbackgroundwithblock { (objects: [anyobject]?, error: nserror?) -> void in if error == nil { // find succeeded. println("successfully retrieved \(objects!.count) scores.") // found objects if let objects = objects as? [pfobject] { object in objects { // update object here } // save changes objects pfobject.saveallinbackground() } } else { // log details of failure println("error: \(error!) \(error!.userinfo!)") } }
im not sure trying do, perhaps looking for:
parse.cloud.define("updatescores", function(request, response) { var query = new parse.query("gamescore"); query.equalto("playername", "sean plott"); query.each(function (object) { // object object.save(); }).then(function (success) { request.success("ok"); }, function(err) { request.error(err); }); });
Comments
Post a Comment