{
"name": "user2",
"avatar": 1,
"email": "[email protected]",
"categories": [
{
"cname": "Category 1",
"list": [
{
"status": "pending",
"name": "List Item 1"
},
{
"status": "pending",
"name": "List Item 2"
}
]
}
]
}
I want to update "categories.list.status" = "pending" to "completed". How can I do it? I tried using positional operator($) but it is giving error too many positional operator.
2
Answers
I tried this. It worked.
If you are using Mongoose (as your tags suggest), you can just update the value in the document object and then save it