Skip to content

Delete First

Description

This operation deletes values from the beginning of the list and returns them in the response.

Method

Backendless.Hive(hiveName).ListStore(keyName).deleteFirst(count): Promise<values[]>;

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keyName Key name identifying a list. String value.
count Optional parameter, defaults to1. Specify the number of values to delete from the beginning of the list.

Return Value

An array containing deleted values.

Examples

The example below deletes 2 values from the beginning of the 'fruits' list.

await Backendless.Hive('demoHive').ListStore('fruits').deleteFirst(2)

where:

Argument                Description
'demoHive' Name of a hive where the operation is performed.
'fruits' Key name identifying a list.

You can also use this operation without the count parameter. When the count parameter is not used, then this operation always deletes the first value from the beginning of the list.

await Backendless.Hive('demoHive').ListStore('fruits').deleteFirst()

where:

Argument                Description
'demoHive' Name of a hive where the operation is performed.
'fruits' Key name identifying a list.


Codeless Reference
list_api_example_delete_first

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a list.
position: first Instructs Hive to delete the first value from the beginning of the list.
count Specifies the number of items to delete.

Returns a list of the deleted values.

Consider the following List storage:

list_api_example_get_values_2

The example below deletes the first value from the beginning of the list:
list_api_example_delete_first