Skip to content

ZDEL

Deletes a key from the ZMap ordered key-value store.

ZDEL <key>
ParameterTypeRequiredDescription
keybytesYesThe key to delete.

Simple string: OK on success.

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 BEGIN has been issued, the delete is staged in the current transaction and only takes effect when COMMIT is called.

All data is scoped to the session’s active namespace. The same key in different namespaces refers to different entries.

Error CodeDescription
ERRWrong number of arguments or internal failure.

Delete an existing key:

> ZSET mykey "Hello"
OK
> ZDEL mykey
OK
> ZGET mykey
(nil)

Delete a non-existent key:

> ZDEL nosuchkey
OK

Use within an explicit transaction:

> ZSET mykey "Hello"
OK
> BEGIN
OK
> ZDEL mykey
OK
> COMMIT
OK
> ZGET mykey
(nil)