$unset¶
-
$unset¶ The
$unsetoperator deletes a particular field. Consider the following example:The above example deletes
field1incollectionfrom documents wherefieldhas a value ofvalue1. The value of the field in the$unsetstatement (i.e.""above) does not impact the operation.If documents match the initial query (e.g.
{ field: value1 }above) but do not have the field specified in the$unsetoperation (e.g.field1), then the statement has no effect on the document.