I am wokring with mongoose in Nodejs. I have strange problem that when I am trying to update the objects in DB by ids, only the first 'id' is being updated. Here is my code:
user.update({'_id': { $in: req.body.ids}},
{ $addToSet: { forms: { $each: req.body.forms} } })
I checked the array of ids and there are 3 of them, but I get the response from the update:
{ n: 1,
nModified: 1,
...