How can I pass the result of my MongoDB query to a const variable so it can be used globally across my application
Here is what i have tried
let dimension;
Settings.find({_id : "5d7f77d620cf10054ded50bb"}).select('dimension').exec((err , found) =>{
if(err){
console.log(err);
}else{
dimension = found[0].dimension;
console.log(found[0].dimension); ///here actually print out my expected result....
}
});
console.log(dimension) /// Here prints undefined