I'm trying to add a new message (with key "3") to the nested "messages" document but $addToSet or $push won't work. Is it possible to push a new message element to such a structure? In the beginning the messages property was an array but my mongodb provider converts arrays into such structures. Just for your information: I'm accessing the mongodb via node.js and mongojs but a native mongodb solution would be perfect too.
{
"messages" :
{
"0" :
{
"foo": "bar0"
},
"1" :
{
"foo": "bar1"
},
"2" :
{
"foo": "bar2"
},
},
"name" : "MyName"
}