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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -