Skip to main content

unset

unset is a DML operation that removes one key from a mapping.

Use it for idempotent cleanup when a missing key should not be an error.

YOp

- unset:
path: config/database/password

Parameters

ParameterTypeRequiredDescription
pathstringyesPath to the mapping key to remove.

Behavior

  • Removes the final key when it exists.
  • Does nothing when the final key is absent.
  • Requires the parent to be a mapping.
  • Rejects final sequence index or match selectors because it removes mapping keys.

Errors

ErrorMeaning
NOT_A_MAPPINGThe parent is not a mapping.

Example

yops:
- unset:
path: config/database/password

Input:

config:
database:
host: localhost
password: secret

Output:

config:
database:
host: localhost