{
  "schema_version": 2,
  "id": "commands/lmpop",
  "title": "LMPOP",
  "url": "https://redis.io/docs/latest/commands/lmpop/",
  "summary": "Returns multiple elements from a list after removing them. Deletes the list if the last element was popped.",
  "since": "7.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:47:41+01:00",
  "page_type": "content",
  "content_hash": "4872ce09f96cca002ffff1bfae2ea3bc10b209ebe530c903b82de3ed2b6811df",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "> [!NOTE]\n> This command's behavior varies in clustered Redis environments. See the [multi-key operations](https://redis.io/docs/latest/develop/using-commands/multi-key-operations) page for more information.\n\n\nPops one or more elements from the first non-empty list key from the list of provided key names.\n\n`LMPOP` and [`BLMPOP`](https://redis.io/docs/latest/commands/blmpop) are similar to the following, more limited, commands:\n\n- [`LPOP`](https://redis.io/docs/latest/commands/lpop) or [`RPOP`](https://redis.io/docs/latest/commands/rpop) which take only one key, and can return multiple elements.\n- [`BLPOP`](https://redis.io/docs/latest/commands/blpop) or [`BRPOP`](https://redis.io/docs/latest/commands/brpop) which take multiple keys, but return only one element from just one key.\n\nSee [`BLMPOP`](https://redis.io/docs/latest/commands/blmpop) for the blocking variant of this command.\n\nElements are popped from either the left or right of the first non-empty list based on the passed argument.\nThe number of returned elements is limited to the lower between the non-empty list's length, and the count argument (which defaults to 1)."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>numkeys</code></summary>\n\nThe number of keys that follow.\n\n</details>\n\n<details open><summary><code>key [key ...]</code></summary>\n\nOne or more keys of lists to operate on.\n\n</details>\n\n<details open><summary><code>LEFT | RIGHT</code></summary>\n\nThe end of the list to pop elements from: `LEFT` (head) or `RIGHT` (tail).\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>COUNT count</code></summary>\n\nThe number of elements to pop. Defaults to 1.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> LMPOP 2 non1 non2 LEFT COUNT 10\n(nil)\nredis> LPUSH mylist \"one\" \"two\" \"three\" \"four\" \"five\"\n(integer) 5\nredis> LMPOP 1 mylist LEFT\n1) \"mylist\"\n2) 1) \"five\"\nredis> LRANGE mylist 0 -1\n1) \"four\"\n2) \"three\"\n3) \"two\"\n4) \"one\"\nredis> LMPOP 1 mylist RIGHT COUNT 10\n1) \"mylist\"\n2) 1) \"one\"\n   2) \"two\"\n   3) \"three\"\n   4) \"four\"\nredis> LPUSH mylist \"one\" \"two\" \"three\" \"four\" \"five\"\n(integer) 5\nredis> LPUSH mylist2 \"a\" \"b\" \"c\" \"d\" \"e\"\n(integer) 5\nredis> LMPOP 2 mylist mylist2 right count 3\n1) \"mylist\"\n2) 1) \"one\"\n   2) \"two\"\n   3) \"three\"\nredis> LRANGE mylist 0 -1\n1) \"five\"\n2) \"four\"\nredis> LMPOP 2 mylist mylist2 right count 5\n1) \"mylist\"\n2) 1) \"four\"\n   2) \"five\"\nredis> LMPOP 2 mylist mylist2 right count 10\n1) \"mylist2\"\n2) 1) \"a\"\n   2) \"b\"\n   3) \"c\"\n   4) \"d\"\n   5) \"e\"\nredis> EXISTS mylist mylist2\n(integer) 0"
    },
    {
      "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\nOne of the following:\n* [Nil reply](../../develop/reference/protocol-spec#bulk-strings): if no element could be popped.\n* [Array reply](../../develop/reference/protocol-spec#arrays): a two-element array with the first element being the name of the key from which elements were popped and the second element being an array of elements.\n\n**RESP3:**\n\nOne of the following:\n* [Null reply](../../develop/reference/protocol-spec#nulls): if no element could be popped.\n* [Array reply](../../develop/reference/protocol-spec#arrays): a two-element array with the first element being the name of the key from which elements were popped and the second element being an array of elements."
    }
  ],
  "examples": []
}
