$[<identifier>] with arrayFilter update works on CLI but not via monk
- Dominant language
- JavaScript
- Stars
- 1.8k
- Forks
- 180
- PR merge metrics
- No merged PRs in 30d
Description
This update works in CLI, however when I run it through monk it fails due to: `No array filter found for identifier 'attendee' in path 'attendees.$[attendee].charge.payment_id'` :
```
var mongo = require('mongodb');
var monk = require('monk');
var db = monk(config.get('mongo.uri'));
var col = db.get('col')
col.update({
'entity.id': '5be5e93061d510116506df51',
scheduled_to: {
$lte: new Date("2018-12-20T11:59:09.896Z")
},
attendees: {$exists: true}
},{
$set: {
"attendees.$[attendee].charge.payment_id": 234
}
},{
multi: true,
arrayFilters: [{
'attendee.charge.currency': 'USD',
'attendee.charge.payment_id': {$exists: false}
}]
},function(err){
console.log(err)
})
```
db version is 3.6.9
monk version is 6.0.6
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the supplied update through Monk 6.0.6 against MongoDB 3.6.9, then trace how the update options are passed to the MongoDB driver. Done means the arrayFilters option reaches the database unchanged and the update succeeds, with a regression test covering the shown array-filter expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100