title: Update Mongodb with node js express and PUG(JADE)
body: <p>I am trying to add an edit page where I can change the name field in the mongodb.But I am having problems with the routing, can anyone please help? here is the routing:</p>
  
  <pre><code>router.put('/edit', function(req, res) {
  user.findByIdAndUpdate({_id: req.params.id},
                   {
          name: req.body.name
       });   
    });
  </code></pre>
  
  <p>And here is edit.pug</p>
  
  <pre><code>extends layout
  
  block content
    .main.container.clearfix
      h1 Editing #{name}'s profile!
      form(method="POST", action="/edit")
       input(type="hidden", name="_method", value="PUT")
       p Name:
        input#name.form-control(type='text', value='#{name}')
       p
        input(type="submit")
  </code></pre>
  
  <p>Thank you</p>