title: Display FindOne query in Nodejs ejs
body: <p>I can get all database data to render in my ejs. I am having trouble selecting one record i.e. returning jacks records. The findOne seems to work as console.log on FindOne returns that persons record, but it is not working on the ejs page, getting my No record found message.</p>
  
  <p>Working code for finding all is:</p>
  
  <p>Server.js</p>
  
  <pre><code>app.get('/vieworders', require('connect-ensure-login').ensureLoggedIn(), function(req, res) {
            Order.find(function(err, orders) {
            res.render('vieworders', { orders: orders});
        });
  });
  </code></pre>
  
  <p>and ejs</p>
  
  <pre><code>&lt;h1&gt; Display Orders Here &lt;/h1&gt;
  &lt;% if(orders.length&gt;0) { %&gt;
  &lt;table border="1"&gt;
          &lt;tr&gt;
                  &lt;th&gt;Index&lt;/th&gt;
                  &lt;th&gt;Name&lt;/th&gt;
                  &lt;th&gt;size&lt;/th&gt;
  
          &lt;/tr&gt;
          &lt;% for(var i=0; i&lt;orders.length;i++) { %&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&lt;%= i %&gt;&lt;/td&gt;
                    &lt;td&gt;&lt;%= orders[i].name %&gt;&lt;/td&gt;
                    &lt;td&gt;&lt;%= orders[i].ordersize%&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                &lt;% } %&gt;
  
  &lt;/table&gt;
  &lt;% } else { %&gt;
          No Record Found
        &lt;% } %&gt;
  </code></pre>
  
  <p>What i want is something like the below where instead of getting all record, i only get jacks records</p>
  
  <pre><code>app.get('/vieworders', require('connect-ensure-login').ensureLoggedIn(), function(req, res) {
  
            Order.findOne({name: 'jack'}, function(err, orders) {
            res.render('vieworders', { orders: orders});
  
        });
  });
  </code></pre>