What i want to do is loop through an object of sql queries, execute them one by one while retrieving results and then call the callback after everything is finished. Here is the code:
_.each(fieldValSQL, function(sql, fieldKey) { conn.query(sql, function(err, result) { fields[fieldkey] = result; }); }); //this should execute last cb();