Back to Redis

ZREM

content/commands/zrem.md

latest1.2 KB
Original Source

Removes the specified members from the sorted set stored at key. Non existing members are ignored.

An error is returned when key exists and does not hold a sorted set.

Examples

{{% redis-cli %}} ZADD myzset 1 "one" ZADD myzset 2 "two" ZADD myzset 3 "three" ZREM myzset "two" ZRANGE myzset 0 -1 WITHSCORES {{% /redis-cli %}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |

Return information

{{< multitabs id="zrem-return-info" tab1="RESP2" tab2="RESP3" >}}

Integer reply: the number of members removed from the sorted set, not including non-existing members.

-tab-sep-

Integer reply: the number of members removed from the sorted set, not including non-existing members.

{{< /multitabs >}}