当我尝试运行计数功能时,我得到


E2015-11-09T12:36:10.778Z]v184 Ran cloud function count with:
  Input: {}
  Result: Error: Parse Objects not allowed here
    at n (Parse.js:16:1063)
    at Parse.js:16:1927
    at Array.map (native)
    at n (Parse.js:16:1904)
    at n (Parse.js:16:1995)
    at r.default (Parse.js:16:2422)
    at Object.o.default.setCloudController.run (Parse.js:13:2159)
    at Object.n [as run] (Parse.js:13:1730)
    at e.query.find.success (main.js:10:19)
    at e.<anonymous> (Parse.js:14:28224)

搜索结果引导我到这个 question ,但所有教程都提到以这种方式发送参数。这段代码曾经运行良好。

计数功能:
Parse.Cloud.define('count', function(request, response) {

var query = new Parse.Query('MyS');
  query.equalTo("Notify", true);
  query.notEqualTo ("MainEventCode", '5');

  query.find({
    success: function(results) {
      Parse.Cloud.run('http', {params : results}).then(
        function(result) {
          console.log('httpResponse is : ' + result);
          response.success('Done !');
        }, function(error) {
          console.log('Error while RUN !' + error);
      });
    },
    error: function(error) {
      response.error(error);
    }
  });
});

http 功能:
Parse.Cloud.define('http', function(request, response) {

var query = new Parse.Query(Parse.Installation);
.
.
.
}

最佳答案

我假设 results 是一个 PFObjects 数组。不幸的是,您不能发送 PFObjects 或包含 PFObjects 作为参数的数组。相反,您需要发送它们的对象 ID 数组,并在您的 http 函数中检索实际对象。

关于javascript - 错误 : Parse Objects not allowed here,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33610227/

10-16 12:57