I am having some issues with saving an object parameter into a Mongoose map. My collection looks like this. The collection's name is guildtickets:
{
"_id":"813915771067301888",
"maxopenTickets":"5",
"serverticketnum":"2",
"opentickets": {
"850608478229626891": {
"ticketname":"ticket-0001",
"ticketstatus":"open",
"ticketcreatedby":"843644509324705814"
}
},
"__v":0}
I wish to change the ticketstatus parameter to closed, so the result should be "ticketstatus": "closed". So far I am using:
var queryTicketSchema = await GuildTicketsSchema.findOne({
_id: message.guild.id
});
queryTicketSchema.get(`opentickets`).get(`${message.channel.id}`).ticketstatus = 'closed';
The issue with the code above, is that when logging the collection, the ticketstatus parameter is showed as closed, but while in MongoDB compass, the parameter is still listed as open. Any help is appreciated and more than welcome! Tysm!