I am just trying to check if user_id and comment_id is there in my database table and if they exists, then do x operation or else y operation. And, I am taking this user_id and comment_id at the runtime from the user. So how should I write my if condition using query.equalTo so that I can do my respective operations. Below is the code of what I am trying to do.
Parse.Cloud.define("voteForComment", function(request, response)
{
var insertVote = Parse.Object.extend("trans_Votes");
var vote = new insertVote();
var query = new Parse.Query("trans_Votes");
if(query.equalTo("user_id",
{
__type: "Pointer",
className: "_User",
objectId: request.params.user_id
})) && (query.equalTo("comment_id",
{ __type: "Pointer",
className: "mst_Comment",
objectId: request.params.comment_id
})); // how to write this two equalTo queries..(its showing error)
{
query.find
({
success : function(rec)
{
X operation here
},
error : function(error)
{
response.error(error);
`}
});
}
else
{
y operation here
}
Thanks.