Upstash Documentation

ZADD

Add a member to a sorted set, or update its score if it already exists.
1 min read

Arguments#

keystringrequired#

The key of the sorted set.

options#
xxboolean#

Only update elements that already exist. Never add elements.

nxboolean#

Only add new elements. Never update elements.

chboolean#

Return the number of elements added or updated.

incrboolean#

When this option is specified ZADD acts like ZINCRBY. Only one score-element pair can be specified in this mode.

gtboolean#

Only update existing elements if the new score is greater than the current score. Add element without a check if it does not exist.

ltboolean#

Only update existing elements if the new score is less than the current score. Add element without a check if it does not exist.

Response#