Consider the following document:
{
"comments": [
{
"id" : 1,
"userid": "john",
"comment": "lorem ipsum...",
"responses": [
{
"id" : 2,
"userid": "smith",
"comment": "lorem ipsum...",
"responses": [
{
"id" : 3,
"userid": "random",
"comment": "lorem ipsum...",
"responses": [] // I want to push a comment into this array
},
{
"id" : 4,
"userid": "guy",
"comment": "lorem ipsum..."
}
]
},
{
"id" : 5,
"userid": "adam",
"comment": "lorem ipsum..."
}
]
}
]
}
Is there ANY way to push a document into that responses array? So in this case a user wants to comment on a level-3 comment and I want to push that comment into the array. I could send the array positions to the user and back to the server when commenting but I'm pretty sure that's unreliable. Also if a delete would happen in between then (I guess(?)) the positions would change in the array, so it's really a no-go.