I have the following documents:
{
_id: ObjectId('111111111111111111114444'),
books: [
{
id: ObjectId('111111111111111111113333'),
pictures: []
},
{
id: ObjectId('111111111111111111112222'),
pictures: []
}
],
// others attributes
}
What I need to do is to add an element to pictures. Keep in mind that I have the documentId which is the id of the document, and the bookId which is the Id of an element of books.
If I want to add the element {description: "nice picture"} to the document 111111111111111111114444 in the book 111111111111111111113333, the updated document would look like
{
_id: ObjectId('111111111111111111114444'),
books: [
{
id: ObjectId('111111111111111111113333'),
pictures: [
{
description: "nice picture"
}
]
},
{
id: ObjectId('111111111111111111112222'),
pictures: []
}
],
// others attributes
}