title: NodeJS, MongoDB : Pass fetched data and display it on HTML
body: <p>I have written below code to get data from mongodb :</p>
  
  <pre><code>app.get('/StudentQuestionsPage',function(req,res){
      var questions="";
      MongoClient.connect(url, function (err, db) {
      if (err) {
      console.log('Unable to connect to the mongoDB server. Error:', err);
      } 
      else {
      console.log('Connection established to', url);  
      var collection = db.collection('studentQuestions');
      var cursor =collection.find();  
  
      fs.readFile( __dirname + '/StudentQuestionsPage.html', 'utf8', function(err, content) {
        var result = content;
        cursor.each(function (err, doc) {
        if (err) {
          console.log(err);
        } else {
          result +=doc;
        }
          }); 
          res.send(result);
              });
          }
      });
  });
  </code></pre>
  
  <p>I want to pass the questions which is more than 1 to html file and want to show those questions there. I can see the questions are being fetched but I am not sure how I can display them on HTML. <br/>can someone help?</p>
  
  <p>I have added below code :<br/></p>
  
  <pre><code>app.get('/StudentQuestionsPage',function(req,res){  
  var studentQuestions = mongoose.model('studentQuestion', studentQuestionSchema);
  
  fs.readFile( __dirname + '/StudentQuestionsPage.html', 'utf8', function(err, content) {
      var result = content;  
      res.send(result).status({studentQuestions:studentQuestions});
      mongoose.connection.close()
      });
  });
  </code></pre>
  
  <p>But it does not print values on HTML. Below is the screenshot.<a href="https://i.stack.imgur.com/SyrCH.png&lt;br" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SyrCH.png&lt;br" alt="enter image description here"></a></p>
  
  <p>Please let me know how to proceed. Sorry for pinging a lot.</p>