错误:此处不允许解析对象

时间:2015-11-09 13:30:19

标签: javascript parse-platform cloud-code

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

  

错误:此处不允许解析对象

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);
.
.
.
}

2 个答案:

答案 0 :(得分:4)

我假设PFObjectsPFObjects的数组。很遗憾,您无法发送python manage.py db upgrade 或包含{{1}}的数组作为参数。相反,您需要发送其对象ID数组,并检索http函数中的实际对象。

答案 1 :(得分:0)

我建议将对象ID 传递给函数。然后在云端功能:

@Component
public class ModelSpecification 
{
    @Autowired
    EntityManager entityManager;
    
    public CriteriaQuery<A> getSpecQuery() throws ParseException
    {
        CriteriaBuilder builder = entityManager.getCriteriaBuilder();
        CriteriaQuery<A> query = builder.createQuery(A.class);
        Root<A> root = query.from(A.class);
        Join<A,B>   ab = root.join(A_.BS);
        query.where(builder.like(ab.get(B_.I),"x"+"%"));
        return query;
    }
}

这个doc帮助我