Another problem working with mongoose. I want to update task
in document as example below.
For example I want to update completed
field in task with _id=1
in project
with name
inbox.
Is it possible to do in one query?
{
"_id" : ObjectId("5702e0c732faf57c7bb9ebe9"),
"email" : "john@doe.me",
"projects" : [
{
"_id" : "1",
"name" : "inbox",
"tasks" : [
{
"_id" : "1",
"text" : "First task",
"labels" : [
"home",
"phone"
],
"dueDate" : "2016-03-18T11:10:00",
"created" : "2016-03-10T10:10:00",
"completed" : true
},
{
"_id" : "2",
"text" : "Second task",
"labels" : [
"home",
"phone"
],
"dueDate" : "2016-03-18T11:10:00",
"created" : "2016-03-10T10:10:00",
"completed" : false
},
]
},
{
"_id" : "2",
"name" : "work",
"tasks" : [
{
"_id" : "4",
"text" : "Fourth",
"labels" : [
"home",
"phone"
],
"dueDate" : "2016-03-18T11:10:00",
"created" : "2016-03-10T10:10:00",
"completed" : false
}
]
}
]
}