mongoose Model.update() - only update provided values
<p>I have the following schema:</p>

<pre><code>const wordSchema = mongoose.Schema({
  author: {type: String, index: true, default: 'unknown'},
  quote: String,
  source: {type: String, default: 'unknown', index: true},
  rating: {type: Number, default: 0},
  createdAt: {type: Date, default: Date.now},
  updatedAt: {type: Date, default: Date.now},
});
</code></pre>

<p>And the following PUT route in my express app:</p>

<pre><code>// Route to update a quote in the DB
app.put('/words/:id', function(req, res) {
  const quote = new Word({
    _id: req.params.id,
    author: req.body.author,
    quote: req.body.quote,
    source: req.body.source,
    rating: req.body.rating,
    updatedAt: Date.now(),
  });
  Word.update(quote, function(err, raw) {
    if (err) {
      res.send(err);
    }
    res.send(raw);
  });
});
</code></pre>

<p>Now when I send the PUT request, if the parameters set with a default value are not provided, they will be filled with the default values from the Schema. How do I update only the provided values?</p>

<p>Thanks for the help.</p>