Method Signature
Parameters
The key of the sorted set
Either a score-member pair object or options object. If options are provided, at least one score-member pair must follow.ScoreMember object:
score(number): The score for the membermember(TData): The member value to add
Additional score-member pairs to add to the sorted set
ZAddCommandOptions
Only add new elements. Don’t update existing elements. Mutually exclusive with
xx.Only update existing elements. Don’t add new elements. Mutually exclusive with
nx.Only update existing elements if the new score is greater than the current score. Mutually exclusive with
lt.Only update existing elements if the new score is less than the current score. Mutually exclusive with
gt.Modify the return value to be the number of elements changed (added or updated), instead of only newly added elements.
When this option is specified, ZADD acts like ZINCRBY. Only one score-member pair can be specified in this mode.
Response
The number of elements added to the sorted set (not including elements already existing for which the score was updated).When
ch option is used, returns the number of elements that were changed (added or updated).When incr option is used, returns the new score of the member (as a number), or null if the operation was not performed.