Delete Values With Max Score¶
Description¶
This operation retrieves and deletes items with the highest scores from the sorted set. You can specify the number of values to retrieve and delete.
Method¶
Backendless.Hive( hiveName ).SortedSetStore( keyName ).getAndDeleteMaxScore( count ): Promise<items>;
where:
Argument | Description |
---|---|
hiveName |
Name of a hive in the system where the operation is performed. Must be a string. |
keyName |
Key name of a sorted set where score-values with the highest scores are retrieved and deleted from. |
count |
Optional parameter, if not present, defaults to 1. Number of values to delete from the sorted set. |
Return Value¶
An array of the deleted score-value pairs. Each element in the array is an array of two elements: score and the corresponding value.
Example¶
The example below deletes five items with the highest scores from the 'leaderboard'
sorted set.
await Backendless.Hive('hiveName').SortedSetStore('leaderboard').getAndDeleteMaxScore(5)
where:
Argument | Description |
---|---|
'hiveName' |
Name of a hive in the system. |
'leaderboard' |
Key name of a sorted set where to retrieve and delete items from. |
Codeless Reference¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
Key name identifying a sorted set. |
count |
Specify the number of values to delete from the sorted set. |
Returns a list of the deleted score-value pairs.
Consider the following Sorted Set storage:
The example below deletes one value with the maximum score from the "players"
sorted set. Considering the sorted set presented above, the value "Julia"
is deleted since it has the highest score.
The sorted set will look as shown below after the Codeless logic runs.