How to add and remove values in the same array?

Is it possible in one query, add and delete fields from a single field?
db.colll.update({
 tags : 1
},{
 $pull: { tags: 1 },
 $addToSet: { tags: 2 }
}, {
 multi: true
})


Does not work, as mongodb does not allow to appeal to one and tomuzhe field
April 19th 20 at 12:22
0 answer

Find more questions by tags MongoDB