title: Return object created on POST - express.js
body: <pre><code>router.route('/vehicles')
  .post(function (req, res) {
      var vehicle = new Vehicle();
  
      vehicle.make = req.body.make;
      vehicle.model = req.body.model;
      vehicle.color = req.body.color;
  
      vehicle.save(function (err) {
          if (err) {
              res.send(err);
          }
          res.json({message: 'Vehicle was successfully added', make: req.body.make, model: req.body.model, color: req.body.color});
      });
  })
  </code></pre>
  
  <p>As you can see by adding this: <code>make: req.body.make, model: req.body.model, color: req.body.color</code> I was able to successfully return the posted object.</p>
  
  <p>However, that's not quite what I need, besides returning the newly created object I also need to return the id of the newly created object.</p>
  
  <p>How can I do this?</p>