I have a MongoDB document that has an array inside of it:
name: 'This List'
items: [
ObjectId('....'),
ObjectId('....'),
ObjectId('....'),
ObjectId('....'),
ObjectId('....'),
ObjectId('....'),
ObjectId('....'),
ObjectId('....'),
...
]
and I want to replace/update all the items inside the items array with new ObjectIds, how can I archieve this?
I tried by using:
Model.update({ 'items': ObjectId('...') }, { '$set': { 'items.$': (new ObjectId) } }, function(err) { ... })
but it doesn't seem to work