简体   繁体   English

解析服务器云代码查询语法错误141

[英]Parse Server Cloud Code Query Syntax Error 141

I cannot for the life of me get a Parse-server Query to work using cloud code... I simply want to retrieve an object from my mLabs database. 我终生无法使用云代码来运行解析服务器查询...我只是想从我的mLabs数据库中检索对象。 I am running prase server on Heroku with the database on mLabs. 我在Heroku上运行的是prase服务器,数据库在mLabs上。 Currently any attempt to query results in error 141 and the query fails. 当前,任何查询尝试都会导致错误141,并且查询失败。 The code I have been attempting to use to query is as follows: 我一直试图用来查询的代码如下:

Parse.Cloud.define("test", function(request, response) {
     var ratingQuery = Parse.Object.extend("StudentNotes");
     var query = new Parse.Query(ratingQuery);
     query.equalTo("displayName","Billy");
     query.find({
       //Parse.Cloud.useMasterKey();, //THIS LINE CAUSES SERVER CRASH
       useMasterKey: true,
       success: function(results){
        //console.log("received " + results.length + " result(s)");
          response.success("done" + results);
       },
       error: function(error) {
        //error
         response.error("FAILED test Function " + error); //THIS GETS CALLED
       }
     });
});

This query should go into my StudentNotes table and retrieve all notes with the displayName "Billy" However this query fails and I know for a fact that it should return something. 此查询应进入我的StudentNotes表,并检索所有带有displayName“ Billy”的笔记。但是此查询失败,并且我知道它应该返回一些信息。

I can successfully call the custom function, it just replies with my 我可以成功调用自定义函数,它只会回复我的

response.error("FAILED test Function " + error); //THIS GETS CALLED

Can someone please help me figure out why my simple query is not working? 有人可以帮我弄清楚为什么我的简单查询无法正常工作吗? Maybe suggest what I should change or supply me with working code for a simple cloud code query for testing purposes? 也许建议我应该进行哪些更改或向我提供工作代码,以便进行简单的云代码查询以进行测试?

I have successfully solved this problem and gotten regular queries to work. 我已经成功解决了这个问题,并获得了常规查询。 The problem was in my Heroku config vars in the dashboard. 问题出在仪表板上的我的Heroku配置变量中。 My server URL was invalid, never changed from the default of " http://yourappname.com/parse/ " I have to manually enter "yourappname". 我的服务器URL无效,从未更改为默认的“ http://yourappname.com/parse/ ”,我必须手动输入“ yourappname”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM