title: When using Mongoose query, how do I save the query and use it as a parameter when rendering an EJS page?
body: <p>I am trying to build an admin dashboard and part of this admin dashboard, I'd like to present mongoose data such as users and recent tutoring sessions done. I am having trouble saving this data and assigning it to EJS parameters when rendering the page.</p>
  
  <pre><code>// Admin Dashboard
  
    // Find students
    function getUsers() {
    User.find({tutor:false}, function(err, foundItems) {
      return foundItems
    })}
    // Find sessions
    function getSessions() {
    Session.find({}, function(err, foundItems) {
      return foundItems;
    })}
  
  app.get('/admin', function(req, res){
      res.render("pages/admin", {
        users: getUsers(),
        sessions: getSessions()
      })
    });
  </code></pre>