简体   繁体   English

解析查询“无法调用未定义的方法'equalTo'”

[英]Parse Query “Cannot call method 'equalTo' of undefined”

I am trying to send an email parameter in the format {"email":"test@example.com"} to my Parse Cloud code, but when I do, I get the following error: 我正在尝试将格式为{"email":"test@example.com"}的电子邮件参数发送到我的Parse Cloud代码,但是当我这样做时,出现以下错误:

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): 这是我的代码(在main.js ,从第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? 谁能告诉我怎么了?

您需要使用new关键字。

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

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

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