I have the following mongodb collection:
Channels [
{
_id:'1'
members:[
{
_id:'1'
skipRounds:1
},
{
_id:'2'
skipRounds:3
},
]
},
{
_id:'2'
members:[
{
_id:'1'
skipRounds:3
},
{
_id:'2'
skipRounds:5
},
]
},
]
I am trying to be able to set the value on skipRounds for a specific user in a specific channel.
For example: I've tried to set skipRounds for the user with id 2 in channel with id 1 to 10
db.Channels.updateOne({
'_id':'1',
'members._id' : '2'
}, {
$set: {'users.$.skipRounds': 10}
})
but it doesn't seem to work. Anyone knows why?