I have this callback function inside another function -
var getData = function(){
   var x ="";
   myCollection.find().toArray(function(err,records){ //myCollection is declared somewhere else
       x = "this is where I set my variable"; 
   });
   console.log(x); //x is just blank
}
How do I set variable x inside the callback function so that it still retains that value outside of the function scope?Is it possible?
