title: How to populate a list in HTML with array returned from MongoDB with Nodejs
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>app.get("/",function(req,res){
    res.sendFile(__dirname+"/test.html");
    Item.find({},{_id:0,item:1},
    function (err, docs) {
      docs.forEach(doc =&gt; console.log(doc.item));
    });
  });</code></pre>
  </div>
  </div>
  </p>
  <p>I want to be able to populate a list in HTML with the items returned in an array from mongoDB. I do not want to use ejs and would like to keep the js code in the js file. Instead of console logging the result, how can I populate the list in HTML? Below is my simple HTML file. I did tried to research the topic but was not able to find a solution, any help is appreciated!</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en" dir="ltr"&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;link rel="stylesheet" href="/css/styles.css"&gt;
    &lt;/head&gt;
    &lt;body&gt;
  
      &lt;h1&gt;Test&lt;/h1&gt;
      &lt;form action="/" method="post"&gt;
        &lt;ul id='list'&gt;
          &lt;li&gt;
        &lt;label for="item"&gt;Add your item&lt;/label&gt;
        &lt;input type="text" name="item" id=""&gt;
        &lt;/li&gt;
        &lt;input type="submit"&gt;
  &lt;/ul&gt;
      &lt;/form&gt;
  
      &lt;script src="test.js"&gt;&lt;/script&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>