Here is my code in client side
var us_exist=Meteor.call('isUserExists',function(e,r){});
console.log(us_exist)// displaying "undefined" in console
if(us_exist==0)
{
console.log("user not exist")
Meteor.call('updatePosts',this._id,option_data,function(e,r){});
}
else
{
console.log("iser exists");
}
here is my method in server side
isUserExist: function()
{
var u_exist=Polls_Coll.find({question:this.question}, {option1:{$elemMatch:{ids: u_name}}} );
return u_exist.count()
}
It is returning nothing.
When i run it in my browser console it is working fine and displaying result as 0 or 1.