mongodb version 3.0.1
mongoose version 4.0.3
I\'m trying to do this:
groupsModel.updateQ({_id:group._id},{
$unset:{\"moderators\":\"\"},
I wasn't able to reproduce that error message, but as you've seen, Mongoose will only update fields defined in the schema. However, you can override that default behavior by including the strict: false
option:
groupsModel.update(
{_id: group._id},
{$unset: {"moderators": ""}, $set:{"admins": newAdmins}},
{strict: false}
)