...
BugZero found this defect 2802 days ago.
Similar to SERVER-20171, except that client is trying to remove elements from arrays of arrays. There are only two documents in the collection
tess.avitabile commented on Thu, 8 Jun 2017 20:30:46 +0000: Correct, the syntax in the ticket would still be an error. lorne.schachter commented on Thu, 8 Jun 2017 20:22:48 +0000: Tess, That would be the new syntax, right? Thanks, Lorne tess.avitabile commented on Thu, 8 Jun 2017 20:12:04 +0000: Yes, if I understand what they are trying to do, they could write db.survey.update( {}, { $pullAll : {"results.$[].answers": ["a3", "a4"]}}, { multi : true}) david.storch commented on Thu, 8 Jun 2017 20:03:23 +0000: justin.seyster tess.avitabile, your work on array updates will eliminate this limitation, correct?
> 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\" ] } ]})" } })