node.js - $unset is empty. You must specify a field like so: {$unset: {<field>: ...}} -
mongodb version 3.0.1
mongoose version 4.0.3
i'm trying this:
groupsmodel.updateq({_id:group._id},{ $unset:{"moderators":""}, $set:{"admins":newadmins} })
and i'm getting mongoerror catch
stating
'\'$unset\' empty. must specify field so: {$unset: {<field>: ...}}'
but isn't empty.
moderators
, however, isn't in schema, why i'm trying remove it.
i wasn't able reproduce error message, you've seen, mongoose update fields defined in schema. however, can override default behavior including strict: false
option:
groupsmodel.update( {_id: group._id}, {$unset: {"moderators": ""}, $set:{"admins": newadmins}}, {strict: false} )
Comments
Post a Comment