Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用解析云代码更新数据库_Javascript_Backbone.js_Parse Platform - Fatal编程技术网

Javascript 使用解析云代码更新数据库

Javascript 使用解析云代码更新数据库,javascript,backbone.js,parse-platform,Javascript,Backbone.js,Parse Platform,我有一份解析云的工作 Parse.Cloud.job("AuthorSearchField", function(request, response) { //get all author var testItemsQuery = new Parse.Query("Author"); //for each item testItemsQuery.each(function (testItem) { //set search field t

我有一份解析云的工作

Parse.Cloud.job("AuthorSearchField", function(request, response) {

    //get all author
    var testItemsQuery = new Parse.Query("Author");
    //for each item
    testItemsQuery.each(function (testItem) {
      //set search field
      testItem.set("searchField",testItem.get("name").toLowerCase());
      testItem.save()
    }).then(function() {
      response.success("Set searchField");
    }, function(error) {
      response.error("Uh oh, something went wrong.");
    });
});
此作业用于用“名称”内容填充“搜索字段”

我执行这项工作,一切都很好:

但是,基本数据库中没有更新任何内容


我的代码出了什么问题?

我可能会迟到,但现在我们开始:

在每个函数内的代码中,您不返回承诺,因此服务器只运行整个过程。 尝试:

返回testItem.save()

我还建议不要一个一个地保存所有这些项目,而是创建批并保存它们,比如说一次保存100个