I've this simple json:
{
id: 1,
basket: {
box: []
}
}
I need to add itens inside the box array that's child of the basket array.
My attempt:
updateOne({ id: 1}, {
"$push": {
"basket": {
"box": {
"dummy": "test"
}
}
}
}
but it's not working. I am receiving this exception:
UnhandledPromiseRejectionWarning: MongoError: The field 'basket' must be an array but is of type object in document