Can't update subdocument

Hi! I’ve looked through the various posts on this topic and still can’t figure out why it’s not working…

I have a model Assignment which has an array of tasks . I can create Assignments and tasks just fine but I can’t seem to update the data of a task, I get no errors but it just isn’t updated.

Schema

`
const taskSchema = new mongoose.Schema({
  name: { type: String, required: true },
  description: { type: String, required: true },
  status: {
    type: String,
    enum: ["pending", "blocked", "completed"],
    default: "pending",
  },
});

const assignmentSchema = new mongoose.Schema({
  name: { type: String, required: false },
  customer: { type: String, required: false },
  tasks: [taskSchema],
});

`

Update function:
const body = await request.json(); const assignment = await Assignment.findOneAndUpdate( { "tasks._id": id }, { $set: { "tasks.$": body } }, { new: true } );

What am I missing? Feels like I’m going crazy