title: Azure function not returning result
body: <p>I'm following a <a href="https://www.youtube.com/watch?v=89WXgaY-NqY&amp;t=" rel="nofollow noreferrer">tutorial</a> and I can see the correct result from the <code>console.log(result)</code> in the console, but when I make the GET request from postman, it returns nothing. Why is <code>send(200, JSON.parse(JSON.stringify(result)));</code> 
  not working?</p>
  
  <p>I also did a <code>console.log(JSON.parse(JSON.stringify(result)))</code> and it returns correctly the data correctly to the console. Just can't send it in response for some reason.</p>
  
  <pre><code>var MongoClient = require('mongodb').MongoClient;
  var Post = require('./model/post');
  
  module.exports = async function (context, req) {
  
    let currentPage = 1;
    context.log("process.env.CosmosDBConnectionString");
    context.log(process.env.CosmosDBConnectionString);
  
    MongoClient.connect(process.env.CosmosDBConnectionString, (err, client) =&gt; {
  
      let send = response(client, context);
  
      if (err) send(500, err.message);
  
  
      console.log("DBNAME: " + process.env.dbName);
      let db = client.db(process.env.dbName);
  
      let queryDate = Date.now();
  
  
      db.collection('listings').find({}) //test
  
        .toArray((err, result) =&gt; {
          console.log(result);
          if (err) send(500, err.message);
          send(200, JSON.parse(JSON.stringify(result)));
  
        });
    });
  
  
  
  
  };
  
  function response(client, context) {
    return function (status, body) {
      context.res = {
        status: status,
        body: body
      };
  
      client.close();
      context.done();
    };
  }
  
  </code></pre>