Intersection¶
Description¶
This operation finds and returns identical values between two or more sorted sets. When a value appears in more than one input sorted set, the resulting score is a sum of the scores from each sorted set.
Method¶
Backendless.Hive( hiveName ).SortedSetStore.intersection( keyNames ): Promise<values>;
where:
Argument | Description |
---|---|
hiveName |
Name of a hive where the operation is performed. String value. |
keyNames |
An array containing key names each identifying a sorted-set. Must be an array of string values. |
Return Value¶
An array of values that are present in all referenced sorted sets. The structure of the response is an array of arrays. Each individual element of the top level array is an array consisting of two elements - score and value. The score is the sum of all individual scores for the corresponding values from all referenced sorted sets.
Example¶
Consider the following sorted sets:
The example below finds identical values in the 'League1Players'
and 'League1Players'
sorted sets. Note that the score of identical values found in the specified sorted sets is summed.
await Backendless.Hive('leaderboard').SortedSetStore.intersection(['League1Players', 'League2Players'])
where:
Argument | Description |
---|---|
'leaderboard' |
Name of the hive in the system. |
Response
[
[
24,
"Frank"
],
[
26,
"Dave"
],
[
28,
"Bobby"
]
]
Codeless Reference¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
A list containing key names identifying unique sorted sets. |
Returns a list of values that are present in all referenced sorted sets. The structure of the response is a list of list. Each individual element of the top level list is a list consisting of two elements - score and value. The score is the sum of all individual scores for the corresponding values from all referenced sorted sets.
Consider the following Sorted Set storage:
The example below finds identical score-value pairs in the following sorted sets: "players"
and "players_2"
.
The output will look as shown below after the Codeless logic runs. Note that the score of identical values found in the specified sorted sets is summed.