ZDEL
Deletes a key from the ZMap ordered key-value store.
Syntax
Section titled “Syntax”ZDEL <key>Arguments
Section titled “Arguments”The argument is positional.
| Argument | Type | Required | Description |
|---|---|---|---|
key | bytes | Yes | The key to delete. |
Return Value
Section titled “Return Value”Simple string: OK on success.
Behavior
Section titled “Behavior”ZDEL removes a key and its associated value from the ZMap subspace of the session’s current namespace, backed by
FoundationDB.
The operation is idempotent: deleting a non-existent key returns OK without raising an error.
The command supports two transaction modes:
- Auto-commit (one-off): When no explicit transaction is active, Kronotop creates a transaction, performs the delete, and commits it immediately. This is the default mode.
- Explicit transaction: When a
BEGINhas been issued, the delete is staged in the current transaction and only takes effect whenCOMMITis called.
All data is scoped to the session’s active namespace. The same key in different namespaces refers to different entries.
Errors
Section titled “Errors”Argument errors:
| Error Code | Error message | Cause |
|---|---|---|
ERR | wrong number of arguments for 'ZDEL' command | - |
Examples
Section titled “Examples”Delete an existing key:
> ZSET mykey "Hello"OK
> ZDEL mykeyOK
> ZGET mykey(nil)Delete a non-existent key:
> ZDEL nosuchkeyOKUse within an explicit transaction:
> ZSET mykey "Hello"OK
> BEGINOK
> ZDEL mykeyOK
> COMMITOK
> ZGET mykey(nil)