Mongoose array update

If you are asking a question, please follow this template:

  1. My goal is: My goal is to update a document that has a schema declared like so. 52%20AM
  2. My actions are: When I add new records this is how it looks in my mongo backend
  3. The result I see is: If the player with the same name renters from the front end then I want to overwrite the corresponding slots array that has been defined. Not add to the array but override the whole thing.

Sor far I have tried $set and finding by the ID that each entry seems to have. I have also tried various forms like
4. My expectation & question is: ```
{$set: {“Week1ScheduleEntries.Slots”: slotArray } }
{$set: {“Week1ScheduleEntries.$.Slots”: slotArray } }


and many more like this. I am trying to find the record like so

const updatedTournamentRecord = await Tournament.findById({_id: idNumber}.

The idNumber field I am able to extract via for loop and within the for loop using await I am trying to make the above query work. Can someone please tell me where i am going wrong and what is the right way to make this overwrite.

https://mongoosejs.com/docs/
This is not related to that.