title: ReferenceError: product is not defined
body: <p>I'm trying to fetch the data , but when i console it.I' getting the data but in rendering it's not working in front end its showing  product is not defined.</p>
  
  <pre><code>app.get('/profile/profile/dashboard/update/:id',function (req,res,next) {
             //console.log("hello "+req.params.id);
      Product.findOne({_id: req.params.id}).then(product=&gt;{
  
          console.log("hello check please "+ product);
      });
  
      res.render('update.ejs',{ product: product });
  });
  </code></pre>
  
  <blockquote>
    <p>update.ejs file </p>
  </blockquote>
  
  <pre><code>&lt;% if (product._id) { %&gt;
          &lt;tbody&gt;
          &lt;td&gt;&lt;input type="text" value="&lt;%= product.name %&gt;" required&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" value="" required&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" value="" required&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" value="" required&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input type="submit" class="btn btn-danger" value="submit"&gt;&lt;/td&gt;
          &lt;/tbody&gt;
          &lt;% } %&gt;
  </code></pre>