title: Request in NodeJS async waterfall return undefined
body: <p>I'm pretty new to async on node js. I use the waterfall method while parsing a xml file like this:</p>
  
  <pre><code>$('situation').each( function(){
  var situation = [];
  $(this).find('situationRecord').each( function(i){
    var record = this;
    async.waterfall([
      function (callback){
        var filter = {
          startLocationCode: $(record).find('alertCMethod2SecondaryPointLocation').find('specificLocation').text(), 
          endLocationCode: $(record).find('alertCMethod2PrimaryPointLocation').find('specificLocation').text(),
          overallStartTime: $(record).find('overallStartTime').text(),
          overallEndTime: $(record).find('overallEndTime').text()
        }
        callback(null, filter, record);
      },
      function (filter, record, callback){
        var timestamp = new Date().toDateInputValue();
        var startDbResponse = 0;
        var endDbResponse = 0;
        if((filter.startLocationCode != '') &amp;&amp; new Date(timestamp) &gt;= new Date(filter.overallStartTime) &amp;&amp; new Date(timestamp) &lt;= new Date(filter.overallEndTime) ){
          startDbResponse = locationCodeToGeodataRequst.geodataByLocationcode(filter.startLocationCode);
          endDbResponse = locationCodeToGeodataRequst.geodataByLocationcode(filter.endLocationCode);
        }
        console.log("startDbResponse: ", startDbResponse);
        console.log("endDbResponse: ", endDbResponse);
        callback(null, filter, record, startDbResponse, endDbResponse);
      },
      function (filter, record, startDbResponse, endDbResponse, callback){
       console.log("startDbResponse: ", startDbResponse);
       console.log("endDbResponse: ", endDbResponse);          
       var situationRecord = createSituationRecord($, record, filter.startLocationCode, filter.endLocationCode, startDbResponse, endDbResponse);
        console.log(situationRecord);
      },
      function (situationRecord, callback){
        situation[i] = { situationRecord };
      }
    ],
    function(err, results){
      console.error("There was an error by filtering the xml file");
      console.error(err);
    });
  })
  if(situation.length &gt; 0){ //if situation is not empty
    locations.push(situation);
  }
  })
   console.log(locations);
  }
  </code></pre>
  
  <p>In this part of the waterfall I make a request to my database with <code>locationCodeToGeodataRequst.geodataByLocationcode(filter.startLocationCode);</code> but <code>startDbResponse</code> and <code>endDbResponse</code> is <code>undefined</code>  :</p>
  
  <pre><code> ....
   function (filter, record, callback){
        var timestamp = new Date().toDateInputValue();
        var startDbResponse = 0;
        var endDbResponse = 0;
        if((filter.startLocationCode != '') &amp;&amp; new Date(timestamp) &gt;= new Date(filter.overallStartTime) &amp;&amp; new Date(timestamp) &lt;= new Date(filter.overallEndTime) ){
  
          startDbResponse = locationCodeToGeodataRequst.geodataByLocationcode(filter.startLocationCode);
          endDbResponse = locationCodeToGeodataRequst.geodataByLocationcode(filter.endLocationCode);
  
        }
        console.log("startDbResponse: ", startDbResponse);
        console.log("endDbResponse: ", endDbResponse);
        callback(null, filter, record, startDbResponse, endDbResponse);
      },
  ....
  </code></pre>
  
  <p>The request by it self works because a console.log in the request module show the correct data. So I don't understand why its undefined.</p>
  
  <p>This is the request module:</p>
  
  <pre><code>exports.geodataByLocationcode = function geodataByLocationcode(locationcode){
   let sql = "SELECT * FROM tmc WHERE LOCATION_CODE = " + locationcode;
   let query = db.query(sql, (err, result) =&gt;{
    if(err == null){
      //console.log(result);
      return result;
    }else{
      console.log("Error by getting item from db: " + err);
      throw err;
    }
   });
  }
  </code></pre>
  
  <p>This is a snipped of the console.log:</p>
  
  <pre><code>....
  startDbResponse:  undefined
  endDbResponse:  undefined
  startDbResponse:  undefined
  endDbResponse:  undefined
  startDbResponse:  0
  endDbResponse:  0
  startDbResponse:  0
  endDbResponse:  0
  []
  //here comes the output of the requests as json objects
  .... 
  </code></pre>