Redis Advanced icon

Redis Advanced

Get, send and update data in Redis with enhanced operations

Sorted Set Add

AI-generated

Summary

Add one or more members with associated scores to a Redis sorted set identified by its name.

Inputs

  • Sorted Set (required) — The name of the sorted set to which members will be added.
  • Score-Member Pairs (required) — Pairs of scores and members in the format "score1 member1 score2 member2" representing the values and their scores to add to the sorted set.

Output shape

a list containing an object with details about the insertion result

The output includes the sorted set name, the count of new members added, and an array of added score-member objects. An error is thrown if the score-member pairs are not provided in even numbers.

Examples

Example 1: Add two members with scores to a sorted set named 'mySortedSet'

Set 'Sorted Set' to 'mySortedSet' and 'Score-Member Pairs' to '1.0 member1 2.0 member2'.

Discussion