Skip to main content

Usage

Returns all field names in the hash stored at key.

Parameters

key
string
required
The key of the hash

Response

fields
string[]
An array of field names in the hash. Returns an empty array if the key does not exist.

Examples

Get all field names

Check available fields

Iterate over fields

Get field count

Validate schema

Non-existent key

Filter fields by pattern

Compare field sets

Export field names for documentation

Notes

  • The order of fields in the returned array is not guaranteed
  • Returns an empty array for non-existent keys
  • Use HGETALL if you need both field names and values
  • For very large hashes, consider using HSCAN to iterate incrementally

See Also

  • HVALS - Get all values in a hash
  • HGETALL - Get all fields and values in a hash
  • HEXISTS - Check if a hash field exists