Help with Mongoose Query

So…

app.patch("/api/:id/:class/gradeupdate", (req, res) => {
  const { id, className } = req.params;
  const grade = req.body.grade;
  Student.updateOne(
    { _id: id },
    { $set: { "classes.$.className.$.grade": grade } },
    (err, success) => (err ? console.log(err) : res.send(success))
  );
});

classes is an obj. I need to update ‘grade’ within a specific class being passed as params.
I know the operator is incorrect.
How can I access grade…

student: {
name: "",
email:"",
classes: [
{name: "history", grade: "a", assignments: []
]
}