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¶
PUT
Endpoint URL¶
Important
Make sure to replace xxxx in the domain name in the request specification below to the one assigned to your application.
https://xxxx.backendless.app/api/hive/[hive-name]/sorted set/[key]/get-with-min-score-and-delete?count=[howMany]
where:
Argument | Description |
---|---|
[hive-name] |
Name of a hive where the operation is performed. |
[key] |
Key name identifying a sorted set. |
[howMany] |
Optional parameter, if not specified, defaults to 1. Number of items to retrieve and delete. |
Request Headers¶
None.
Request Body¶
None.
Response Body¶
A JSON array of the deleted score-value pairs.
Example¶
The example below will delete 2
items with the lowest score from the approvedTransactions
sorted set.
curl --location --request "https://xxxx.backendless.app/api/hive/demoHive/sorted set/mySortedSet/get-with-min-score-and-delete?count=2"
where:
Argument | Description |
---|---|
demoHive |
Name of a hive in the system. |
mySortedSet |
Name of a sorted set to delete score-value pairs 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.