When a user register, he's profile must get some values from another website.
I have written a function that returns these values, but it won't work, as I want it to.
Here's the code:
var user = new User(); // to create him in the database
user.userData.someVariable = myFunc(someID);
function myFunc(someID){
.......
Users.findOne({'someVar': someID}, function(err, user){
if(err)
throw err;
if(user)
return user.userData.id; // it doesn't return it, but it has found it
// I can even console.log it, and I see that it exists, but user.userData.someVariable wont be set to user.userData.id
else if(!user) throw err;
}
}
Any help? Is there something else I can do to get the value? Thank you!