Delete Values With Min Score¶
Description¶
This operation retrieves and deletes items with the lowest scores from the sorted set. You can specify the number of values to retrieve and delete.
Method¶
Backendless.Hive( hiveName ).SortedSetStore( keyName ).getAndDeleteMinScore( 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 lowest scores are retrieved and deleted from. |
count |
Optional parameter, if not specified, defaults to 1. Number of values to deleted 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 will delete five items with the lowest scores from the 'leaderboard'
sorted set.
await Backendless.Hive('hiveName').SortedSetStore('leaderboard').getAndDeleteMinScore(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 items 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 minimum score from the "players"
sorted set. Considering the sorted set presented above, the value "Bobby"
is deleted since it has the lowest score.
The sorted set will look as shown below after the Codeless logic runs.