I have the following collection:
Collection =
{
_id: "TYcV70JNDCZ4Kk72ut",
text: {
[{
[{
textId: 123,
posted: 0
},
{
textId: 1234,
posted: 0
}]
}],
[{
[{
textId: 78,
posted: 0
},
{
textId: 789,
posted: 0
}]
}]
}
}
So, I have a collection that has an array called text
and each element of text
is also an array. How would I change the values of the item posted
within the inner most array if the textId is for example 123
?
This is what I tried so far and it hasn’t worked out:
Collection.update({_id: "TYcV70JNDCZ4Kk72ut", "text.textId": 123},
{$set: {"text.posted": 1}});