i want to return (true,false) from this function, its returning object.. what i can do to return Boolean value ? this code is make a static method to users Module
users.statics.is_username_used = function(name) {
return this.findOne({username: name}, function(error,doc){
if(is_empty(doc)){
return false;
}else{
return true;
}
});
};