期待される出力: "x is 2" 実際の出力: "x is undefined"
app.js
var x = db_Save(req.session.user);
console.log('x is ' + x);
dbFile.js
var db_Save= function (user) {
// return 2; /* 'x is 2' would print;
console.log('function returns "undefined" before following');
userProfile.find({Email: profileInstance.Email}, function(err, doc){
console.log('prints after "x is undefined"');
return 2; // does not get returned
});
}