I need to return the results of a query with mongoose in node.js.
How do you return the value to set the value to a variable?
What I need to do is:
It is being executed before the assignment.
async function(req, res) { var user; await users.findOne({}, function(err,pro){ user=pro; }); console.log(user); \\ it's define };