{
  "id": "hgetdel",
  "title": "HGETDEL",
  "url": "https://redis.io/docs/latest/commands/hgetdel/",
  "summary": "Returns the value of a field and deletes it from the hash.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-06-16T14:32:28+01:00",
  "page_type": "content",
  "content_hash": "2281b518c1a5ecc5441fbb5e2129fdcba47265222f074482cb881ca197768e71",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Get and delete the value of one or more fields of a given hash key. When the last field is deleted, the key will also be deleted."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the key that holds the hash.\n\n</details>\n\n<details open><summary><code>FIELDS numfields field [field ...]</code></summary>\n\nThe hash fields to get and then delete. `numfields` is the number of fields, followed by that many field names.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays): a list of deleted fields and their values or `nil` for fields that do not exist.\n\n**RESP3:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays): a list of deleted fields and their values or `nil` for fields that do not exist."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "redis> HSET mykey field1 \"Hello\" field2 \"World\" field3 \"!\"\n(integer) 3\nredis> HGETALL mykey\n1) \"field1\"\n2) \"Hello\"\n3) \"field2\"\n4) \"World\"\n5) \"field3\"\n6) \"!\"\nredis> HGETDEL mykey FIELDS 2 field3 field4\n1) \"!\"\n2) (nil)\nredis> HGETALL mykey\n1) \"field1\"\n2) \"Hello\"\n3) \"field2\"\n4) \"World\"\nredis> HGETDEL mykey FIELDS 2 field1 field2\n1) \"Hello\"\n2) \"World\"\nredis> KEYS *\n(empty array)",
      "section_id": "examples"
    }
  ]
}
