> db.survey.find()
{
"_id": 1,
"results": [
{
"item": "A",
"score": 5,
"answers": [
"a1",
"a2",
"a3"
]
},
{
"item": "B",
"score": 8,
"answers": [
"a2",
"a3",
"a4"
]
}
]
}
{
"_id": 2,
"results": [
{
"item": "C",
"score": 8,
"answers": [
"a1",
"a2"
]
},
{
"item": "B",
"score": 4,
"answers": [
"a1",
"a2"
]
}
]
}
> db.survey.update( {}, { $pullAll : {"results.answers": ["a3", "a4"]}}, { multi : true})
cannot use the part (results of results.answers) to traverse the element ({results: [ { item: "A", score: 5.0, answers: [ "a1", "a2", "a3" ] }, { item: "B", score: 8.0, answers: [ "a2", "a3", "a4" ] } ]})
WriteResult({
"nMatched": 0,
"nUpserted": 0,
"nModified": 0,
"writeError": {
"code": 16837,
"errmsg": "cannot use the part (results of results.answers) to traverse the element ({results: [ { item: \"A\", score: 5.0, answers: [ \"a1\", \"a2\", \"a3\" ] }, { item: \"B\", score: 8.0, answers: [ \"a2\", \"a3\", \"a4\" ] } ]})"
}
})