hey guys l have a query and l am trying to save its data into a variable but it keeps on returning undefined everytime l call the variable. The values l am trying to save into to the variable are from the database so l can loop over them with a forEach loop on a later stage
This is my code:
var userData = db.users.find({}, function(err, data){return data})
console.log(userData);
l tried to use some of the answers from other posts with people who have encountered the same problem but l am not getting anywhere