Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$[<identifier>] with arrayFilter update works on CLI but not via monk #269

Open
shaharsol opened this issue Dec 11, 2018 · 1 comment
Open

Comments

@shaharsol
Copy link

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

@dushaobindoudou
Copy link

It may be due to the version. It is recommended to upgrade to the latest version。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants