Matt
Matt

Reputation: 2722

Parse Query "Cannot call method 'equalTo' of undefined"

I am trying to send an email parameter in the format {"email":"[email protected]"} to my Parse Cloud code, but when I do, I get the following error:

Failed with: TypeError: Cannot call method 'equalTo' of undefined
at main.js:19:8

Here is my code (in main.js, starting on line 16):

Parse.Cloud.define("searchFriendViaEmail", function(request, response) {
    console.log(request.params);
    var query = Parse.Query("_User");
    query.equalTo("email", request.params.email);
    query.find({
        success: function(results) {
            response.success(results[0]);
        },
        error: function() {
            response.error("user lookup failed");
        }
    });
});

Can anyone tell me what's going wrong?

Upvotes: 0

Views: 924

Answers (1)

SteamDev
SteamDev

Reputation: 4404

You need to use the new keyword.

var query = new Parse.Query("_User");

Upvotes: 5

Related Questions