I'm creating a Node project cause i want to knwo how to use mongoose but i'm facing a problem right now. I'm getting an undefined variable while returing a collection from my MongoDB database. This is my code:
app.js
...
case 'index-user':
        let indexUserResponse = userController.index();
        console.log(indexUserResponse); // undefined
        break;
...
user.js (controller)
...
const index = () => {
    User.find({}, function(err, res) {
        if (err) throw err;
        return res;
    });
}
...
I know that there is a user on the database and i can see it if add a console.log(user) just before the return res; so... What is happening here? I don't get it.
 
    