P
Prisma6mo ago
Nik

Update nested field in composite types

I have a deeply nested structure. It has to be this way. I want to update a single field at the end of the nested tree structure. How do I accomplish this?
1 Reply
Nik
Nik6mo ago
This is the only viable solution I've found but seems very verbose: It seems a bit verbose:
game_players:{
update:{
"0":{
upsert:{
update:{
proposals:{
update:{
"1":{
push: {
select_phase_start: {...select_phase_start, chatIndex: data.chat.length, log_time, propNumber},
vote_mades: {}
}
}
}
}
},
set:{
...game_player,
Color:2
}
},
}
}
}
game_players:{
update:{
"0":{
upsert:{
update:{
proposals:{
update:{
"1":{
push: {
select_phase_start: {...select_phase_start, chatIndex: data.chat.length, log_time, propNumber},
vote_mades: {}
}
}
}
}
},
set:{
...game_player,
Color:2
}
},
}
}
}
I understand the type-safety argument but I'd much rather have the option to use a mongoose-type selector with a throw if something goes wrong
Want results from more Discord servers?
Add your server