Update fields of Mongoose document object from request body
<p>The question(<a href="https://stackoverflow.com/q/27315849/3239341">Mongoose save all parameters from request body</a>) shows how to create new mongoose document object with request body in a line of code.<br>
Extending this question, I want to know how to set all fields of mongoose document object at once.  </p>

<pre class="lang-js prettyprint-override"><code>router.route('/car')
.put(function(req, res, next) {
  Car.findById(req.params.id, function (err, car) {
    if (err) {
      res.status(400).send(err);
    } else {
      if (!car)
        return next(new Error('Failed to load car: ' + req.params.id));

      car.name = req.body.name; // Code refactoring required
      car.seats = req.body.seats;
      car.engine_size = req.body.engine_size; 

      car.save(function(err) {
          if(err)
            res.status(400).send(err);
          else
            res.json(car);
      });
    }
  });
});
</code></pre>

<p>In creating document <code>var car = new Car(req.body);</code> is perfect way to fill fields from request body.<br>
<strong>For updating exist mongoose document, is there better way than below lines</strong>:</p>

<pre class="lang-js prettyprint-override"><code>car.name = req.body.name;
car.seats = req.body.seats;
car.engine_size = req.body.engine_size; 
</code></pre>