Skip to content

Contains

Description

This operation checks if specific values exist in a set.

Method

// Check A Single Value
Backendless.Hive(hiveName).SetStore(keyName).isValueMember(value): Promise<boolean[]>;

// Check Multiple Values
Backendless.Hive(hiveName).SetStore(keyName).isValuesMembers(values[]): Promiseboolean[]>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keyName Key name identifying a set. String value.
value Value to check if it exists in the set.
values An array of values to check if they exist in the set.

Return Value

An array containing boolean values. For every specified item, a boolean value is returned indicating if it is present in the set or not. If an item exists, then true is returned in the array, false otherwise.

Example

Check One Value

The example below verifies if the 'Sedan' value exists in the 'cars' set.

await Backendless.Hive('transport').SetStore('cars').isValueMember('Sedan')

where:

Argument                Description
'transport' Name of a hive where the operation is performed.
'cars' Key name identifying a set.

Check Multiple Values

The example below verifies if the 'Sedan' and 'Crossover' values exist in the 'cars' set.

await Backendless.Hive('transport').SetStore('cars').isValuesMembers(['Sedan', 'Crossover'])

where:

Argument                Description
'transport' Name of a hive where the operation is performed.
'cars' Key name identifying a set.

Codeless Reference

set_api_contains

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a set.
items A list of values to check if they exist.

Returns a list containing boolean value(s). For every specified item, a boolean value is returned indicating if it is present in the set or not. If an item exists, then true is returned in the array, false otherwise.

Consider the following Set storage:
set_api_example_all_blocks

The example below checks if "Sedan" and "Crossover" exist in the "cars" set:
set_api_example_contains

The logic produces the following output:

set_api_example_contains_2