title: Using async/await still returns undefined
body: <p>I asked recently about the asynchronous in javascript, <a href="https://stackoverflow.com/questions/53367823/request-promise-module-returns-undefined">request-promise module returns undefined</a>. I quite understand it after someone gave the same SO question which is the <a href="https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call">How do I return the response from an asynchronous call?</a>. I learned a lot which helps me to how properly request an api. But now I encounter the same problem even though I'm using <code>async/await</code> already. I put comments where I'm getting an <code>undefined</code>.</p>
  
  <pre><code>const request = require('request');
  const rp = require('request-promise');
  
  const MongoClient = require('mongodb').MongoClient;
  const ObjectId = require('mongodb').ObjectID;
  
  const CONNECTION_STRING = process.env.DB;
  const dbName = 'fcc';
  const connectionOption = { useNewUrlParser: true };
  
  function StockHandler() {
  
    this.latestWithoutLike = async function(ticker, multipleStock, callback) {
      if (!multipleStock) {
        console.log('Single stock');
        let lastPrice = await getLastPrice(ticker);
  
        if (typeof lastPrice === 'string') {
          getLikes(ticker, false, (data) =&gt; {
  
            let stockData = {
              stock: data.stock,
              price: lastPrice,
              likes: data.likes
            }
  
            return callback({ stockData: stockData });
          });
        }
      } else {
        console.log('Multiple stock');
        let firstStockLastPrice = await getLastPrice(ticker[0]);
        let secondStockLastPrice = await getLastPrice(ticker[1]);
  
        if (typeof firstStockLastPrice === 'string' &amp;&amp; typeof secondStockLastPrice === 'string') {
          let firstStockLikes = await getLikes(ticker[0], false, (data) =&gt; { return data; });
          let secondStockLikes = await getLikes(ticker[1], false, (data) =&gt; { return data; });
  
          console.log(firstStockLikes); // &lt;--- undefined
          console.log(secondStockLikes); // &lt;--- undefined
        }
  
      } 
    };
  
    this.latestWithLike = async function(ticker, multipleStock, callback) {
      if (!multipleStock) {
        console.log('Single stock');
        let lastPrice = await getLastPrice(ticker);
        console.log(lastPrice);
        if (typeof lastPrice === 'string') {
          getLikes(ticker, true, (data) =&gt; {
  
            let stockData = {
              stock: data.stock,
              price: lastPrice,
              likes: data.likes + 1
            }
  
            return callback({ stockData: stockData });
          });
        }
  
      } else {
        console.log('Multiple stock');
        let firstStockLastPrice = await getLastPrice(ticker[0]);
        let secondStockLastPrice = await getLastPrice(ticker[1]);
        console.log(firstStockLastPrice);
        console.log(secondStockLastPrice);
      }
    };  
  
  }
  
  function getLastPrice(ticker) {
    let options = {
      uri:  `https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&amp;symbol=${ticker}&amp;interval=1min&amp;apikey=${process.env.ALPHA_KEY}`,
      method: 'GET',
      json: true
    }
  
    return rp(options)
      .then(function(parsedBody){
        let latestStockTradeTime = Object.keys(parsedBody[Object.keys(parsedBody)[1]])[0];
        let closingPrice = parsedBody[Object.keys(parsedBody)[1]][latestStockTradeTime]['4. close'];
        return closingPrice;
      })
      .catch(function(error){
        return error;
      })
  }
  
  function getLikes(ticker, likeStatus, callback) {
    MongoClient.connect(CONNECTION_STRING, connectionOption, (err, client) =&gt; {
  
      if (err) callback(err);
  
      const db = client.db(dbName);
      const collection = db.collection('stock');
  
      if (!likeStatus) {
        try {
          collection.findOne(
            { stock: ticker.toUpperCase() },
            { upsert: true },
            (err, result) =&gt; {
              if (result === null) {
                collection.insertOne(
                  { stock: ticker.toUpperCase(), likes: 0 },
                  { upsert: true },
                  (err, result) =&gt; {
                    return callback(result.ops[0]);
                  }
                ); 
              } else {
                  return callback(result);
              }
            }
          );
        } catch (e) {
            return callback({ error: e });
        }  
      } 
      else {
        try {
          collection.findOneAndUpdate(
            { stock: ticker.toUpperCase() },
            { $inc : { likes: 1 } },
            { upsert: true, new: true },
            (err, data) =&gt; {
              return callback(data.value);
            }
          );
        } catch (e) {
            return callback({ error: e });
        }
      }
  
    });
  };
  
  module.exports = StockHandler;
  </code></pre>