1

It is obvious that "result" is coming back as null from the query. 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");
    }
});
1
  • Not finding something isn't an error if the request was valid... Commented Jun 29, 2015 at 6:48

1 Answer 1

3

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. 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

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! Understand. My challenge is to now discover why the query is not finding the record that I know exists. Will update here when I get to the bottom of it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.