- Reference >
- Operators >
- Update Operators >
- Field Update Operators >
- $unset
$unset¶
-
$unset¶ The
$unsetoperator deletes a particular field. Consider the following syntax:The specified value in the
$unsetexpression (i.e."") does not impact the operation.To specify a
<field>in an embedded document or in an array, use dot notation.
Behavior¶
If the field does not exist, then $unset does nothing (i.e.
no operation).
When used with $ to match an array element, $unset
replaces the matching element with null rather than removing the
matching element from the array. This behavior keeps consistent the
array size and element positions.