MongoDB uses $ pull to remove dictionary in array subdot
I am trying to remove the following dict in this array:
{
"ProjectID": "8ToGTAUjT+CbcH68ZYuW8Q=="
"Tasks": [
{
"description": "",
"title": "testcounter",
"notes": "",
"percentComplete": "100",
"completedDate": {
"hour": "12",
"year": "2014",
"day": "14",
"minute": "43",
"month": "11"
},
"completed": "",
"ProjectID": "8ToGTAUjT+CbcH68ZYuW8Q==",
"TaskID": "JxHddpQNSguzOqg1sdsdKtyQ=="
},
......
],
......
}
Tasks
is a subdocument in this entry.
I am trying to remove using this:
db.projects.update({'ProjectID': "8ToGTAUjT+CbcH68ZYuW8Q=="},
{'$pull': {'Tasks.TaskID': "JxHddpQNSguzOqg1sdsdKtyQ=="}})
This, however, does not remove this subdocument. How can I remove this character in an array?
+3
source to share