简体   繁体   English

Parse.com Cloud Code错误:TypeError:无法调用未定义的方法'get'

[英]Parse.com Cloud Code error : TypeError: Cannot call method 'get' of undefined

It is obvious that "result" is coming back as null from the query. 很明显,“result”从查询中返回null。 If that is the case, why is it calling the "success" routine? 如果是这样的话,为什么称它为“成功”例程呢? I know that the course I am searching for does exist. 我知道我正在寻找的课程确实存在。

Any ideas? 有任何想法吗?

var query = new Parse.Query("Courses");
var CourseObj = new Parse.Object("Courses");

query.equalTo("courseIdFromIOS", request.params.courseIdFromIOS);
query.first({
    success: function (result) {
        CourseObj = result;
        response.success("course lookup good for: " + CourseObj.get("courseName"));
    },
    error: function () {
        response.error("course lookup failed");
    }
});

A query always enters success loop if we are able to connect to Parse servers and searched through all the rows even if our query was unsuccessful since there is no error code corresponding to unsuccessful query .Once check this guide and also error codes section. 如果我们能够连接到Parse服务器并搜索所有行,即使我们的查询不成功,查询也总是进入成功循环,因为没有与不成功查询相对应的错误代码。请查看本指南以及错误代码部分。 https://www.parse.com/docs/js/guide#handling-errors https://www.parse.com/docs/js/guide#handling-errors

So in your case result is undefined 所以在你的情况下结果是未定义的

var query = new Parse.Query("MyClass");
var tmp = new Parse.Object("MyClass");

query.equalTo("username", "This does not exist in table");
query.first({
    success: function (result) {
        tmp = result;
        alert("hii");
        alert("course lookup good for: " + tmp.get("name"));
    },
    error: function () {
        alert("helloooo");
    }
});

Even in the above code it is entering success loop 即使在上面的代码中,它也进入了成功循环

暂无
暂无

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

相关问题 Parse.com背景作业云代码无法调用未定义的方法'then' - Parse.com Background Job cloud code cannot call method 'then' of undefined Parse.com —云代码/ JS —“无法调用未定义的方法'set'” - Parse.com — Cloud Code/JS — “Cannot call method 'set' of undefined” 如何在Parse.com CloudCode上创建自定义帮助程序模块,以便与then()一起使用? TypeError:无法调用未定义的方法“ then” - how to create a custom helper module on Parse.com CloudCode for using with then() promise? TypeError: Cannot call method 'then' of undefined *简单*解析云代码查询失败“ TypeError:无法调用未定义的方法'get'\\ n检索该信息” - *Simple* Parse Cloud Code query failure “TypeError: Cannot call method 'get' of undefined\n retrieve that info ” Parse.com云代码中的承诺“无法设置未定义的属性'成功'”错误 - “Cannot set property 'success' of undefined” Error with Promises in Parse.com Cloud Code error =“ TypeError:对象[object Object]在main.js:33:12处没有方法'addUnique'\\ n”; 云代码parse.com - error = “TypeError: Object [object Object] has no method 'addUnique'\n at main.js:33:12”; Cloud code parse.com parse.com云代码,后台工作电话 - parse.com cloud code, background job call 解析失败:TypeError:无法调用未定义的方法'get' - Parse Failed with: TypeError: Cannot call method 'get' of undefined parse.com get无法读取未定义的属性'indexOf' - parse.com get Cannot read property 'indexOf' of undefined 如何在parse.com云代码中的beforeSave函数上获取用户ID? - how to get the userID on a beforeSave function in parse.com cloud code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM