Populate objects from inside callbacks

Quite simply, it is possible to populate the object symbols from inside the callbacks?

Cursed closures of javascript!

var symbols = {};
markets.find(function(err, markets) {
   for(var market in markets) {
     symbols[markets[market].symbol] = markets[market].label;
   }
});

console.log(symbols);

async/waterfall is the right solution for this problem. And since .find() is asynchronous, you can do a forEach as well:

markets.forEach(function(m) {
  symbols[m.symbol] = m.label;
});