title: Update a record where _id = :id with Mongoose
body: <p>I'm trying to update an existing record with Mongoose. The insert is OK but not the update.</p>
  
  <p>Here is my snippet:</p>
  
  <pre><code>app.post('/submit', function(req, res) {
  
      var my_visit = new models.visits({
          date: req.body.visit_date,
          type: req.body.visit_type,
          agency: req.body.visit_agency,
          city: req.body.visit_city,
          url: req.body.visit_url,
          note: req.body.visit_note
      });
  
      // INSERT
      if(req.body.id == 0) {
          my_visit.save(function(err) {
              if(err) { throw err; }
  
              console.log('added visit');
  
              res.redirect('/');
          });
      } else { // UPDATE
          var upsertData = my_visit.toObject();
  
          console.log(req.body.id); // OK
  
          models.visits.update({ _id: req.body.id }, upsertData, { multi: false }, function(err) {
              if(err) { throw err; }
  
              console.log('updated visit: '+ req.body.id);
  
              res.redirect('/');
          });
      }
  
  
  })
  </code></pre>
  
  <p>The response is <code>Mod on _id is not allowed</code>.</p>
  
  <p>I just want to update the line such as <code>WHERE id = id</code> in MySQL. I didn't find the right syntax.</p>