title: How to update a subdocument (REF)?
body: <p>I'm using the method below to update all the fields in the &quot;Producers&quot; document.</p>
  <pre><code>exports.updateProducers = async (req, res) =&gt; {
      let obj = new Producers(req.body);
      await Producers.findOneAndUpdate({ &quot;user.nome&quot;: &quot;Naomi&quot;}, obj, {upsert: true, new: true}, function (err) {
          (err ? res.status(400).send(err) : res.status(200).json(obj));
      });
  }
  </code></pre>
  <p>This method works and normally updates all the &quot;Producers&quot; fields, however, I have a reference to the &quot;User&quot; document, done like this:</p>
  <pre><code>user: {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'User',
      required: true
    },
  </code></pre>
  <p>In &quot;Users&quot;, I have the &quot;name&quot; field. How can I add editing on users as well?</p>
  <p>I'm currently getting this message:</p>
  <blockquote>
  <p>MongoError: Performing an update on the path '_id' would modify the immutable field '_id'</p>
  </blockquote>
  <p><strong>I appreciate if anyone can help me analyze what I'm doing wrong?</strong></p>