Just installed 3.6.
In the mongo shell I can run this command without problems
db.images.update(
{},
{$set: { "files.$[elem].comment": "abc" )}
{ arrayFilters: [{
"elem.filename": "114T0231-5_30_NL2500_1_1_0001.jpg",
"elem.dir": "/images/Tools/NL"
}] })
When I run "the same" update in JavaScript under node having installed "mongodb": "^2.2.34":
db.collection('images').update(
query,
{
$set: { "files.$[elem].comment": comment }
},
{
arrayFilters: [{
$and: [
{
"elem.filename": filename
},
{
"elem.dir": dir
}
]
}]
}
).then(....)
I get this error:
{"name":"MongoError","message":"No array filter found for identifier 'elem' in path 'files.$[elem].comment'",
"driver":true,"index":0,"code":2,"errmsg":"No array filter found for identifier 'elem' in path 'files.$[elem].comment'"}
The mongo shell handles the arrayFilters, but it appears that the node driver does not.