I'm trying to get a list of the users in my server but it doesn't work, the list is always empty.
That's my code:
function gettingRegion(){
var listUsers = []
User.find({},function(err, response){
if(!err)
{
listUsers = response
}
})
console.log(listUsers)
}
I tried Async, putting a return inside the .find
and creating a function outside the .find
but it didn't work. Can you help me ?