Skip to content

Get Score

Description

This operation returns the score of a value from a sorted set.

Method

Backendless.Hive( hiveName ).SortedSetStore( keyName ).getScore( value ): Promise<number | null>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keyName Key name identifying a sorted-set. String value.
value The value identifying a score-value pair.

Return Value

The score of the specified item. Otherwise, returns null if the specified key or the value in the sorted set does not exist.

Example

The example below returns the score of the 'JoeTheGamer' item from the 'players' sorted set.

await Backendless.Hive('leaderboard').SortedSetStore('players').getScore('JoeTheGamer')

where:

Argument                Description
'leaderboard' Name of a hive in the system.
'players' Name of a sorted set where the operation takes place.
'JoeTheGamer' Value to get the score of.

Codeless Reference

sorted_set_api_get_score

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a sorted set.
value Value to get the score of.

Returns the score of an item. Returns null if the value does not exist in the sorted set.

Consider the following Sorted Set storage:
sorted_set_api_example_all_blocks

The example below retrieves the score of a value "Julia" from the "players" sorted set:
sorted_set_api_example_get_score

The output will look as shown below after the Codeless logic runs:
sorted_set_api_example_get_score_2